Example #1
0
        public JournalBounty(JObject evt) : base(evt, JournalTypeEnum.Bounty)
        {
            TotalReward = evt["TotalReward"].Long();     // others of them..

            VictimFaction          = evt["VictimFaction"].Str();
            VictimFactionLocalised = JournalFieldNaming.CheckLocalisation(evt["VictimFaction_Localised"].Str(), VictimFaction);

            SharedWithOthers = evt["SharedWithOthers"].Bool(false);
            Rewards          = evt["Rewards"]?.ToObjectProtected <BountyReward[]>();

            Target = evt["Target"].StrNull();       // only set for skimmer target missions

            if (Rewards == null)                    // for skimmers, its Faction/Reward.  Bug in manual reported to FD 23/5/2018
            {
                string faction = evt["Faction"].StrNull();
                long?  reward  = evt["Reward"].IntNull();

                if (faction != null && reward != null)
                {
                    Rewards    = new BountyReward[1];
                    Rewards[0] = new BountyReward()
                    {
                        Faction = faction, Reward = reward.Value
                    };
                    TotalReward = reward.Value;
                }
            }
        }
        public JournalBounty(JObject evt) : base(evt, JournalTypeEnum.Bounty)
        {
            TotalReward = evt["TotalReward"].Long();     // others of them..

            VictimFaction          = evt["VictimFaction"].Str();
            VictimFactionLocalised = JournalFieldNaming.CheckLocalisation(evt["VictimFaction_Localised"].Str(), VictimFaction);

            SharedWithOthers = evt["SharedWithOthers"].Bool(false);
            Rewards          = evt["Rewards"]?.ToObjectQ <BountyReward[]>();

            TargetLocalised = Target = evt["Target"].StrNull();       // only set for skimmer target missions

            if (Target != null)
            {
                TargetLocalised = JournalFieldNaming.CheckLocalisation(evt["Target_Localised"].Str(), Target);  // 3.7 added a localised target field, so try it

                var sp = ItemData.Instance.GetShipProperties(Target);
                if (sp != null)
                {
                    TargetLocalised = ((ItemData.ShipInfoString)sp[ItemData.ShipPropID.Name]).Value;
                }
            }


            if (Rewards == null)                    // for skimmers, its Faction/Reward.  Bug in manual reported to FD 23/5/2018
            {
                string faction = evt["Faction"].StrNull();
                long?  reward  = evt["Reward"].IntNull();

                if (faction != null && reward != null)
                {
                    string factionloc = JournalFieldNaming.CheckLocalisation(evt["Faction_Localised"].Str(), faction);      // not mentioned in frontiers documents, but seen with $alliance, $fed etc
                    Rewards    = new BountyReward[1];
                    Rewards[0] = new BountyReward()
                    {
                        Faction = faction, Faction_Localised = factionloc, Reward = reward.Value
                    };
                    TotalReward = reward.Value;
                }
            }
            else
            {
                foreach (var r in Rewards)
                {
                    r.Faction_Localised = JournalFieldNaming.CheckLocalisation(r.Faction_Localised, r.Faction);
                }
            }
        }
        public JournalBounty(JObject evt) : base(evt, JournalTypeEnum.Bounty)
        {
            TotalReward = evt["TotalReward"].Long();     // others of them..

            VictimFaction          = evt["VictimFaction"].Str();
            VictimFactionLocalised = JournalFieldNaming.CheckLocalisation(evt["VictimFaction_Localised"].Str(), VictimFaction);

            SharedWithOthers = evt["SharedWithOthers"].Bool(false);
            Rewards          = evt["Rewards"]?.ToObjectProtected <BountyReward[]>();

            TargetLocalised = Target = evt["Target"].StrNull();       // only set for skimmer target missions

            if (Target != null)
            {
                TargetLocalised = JournalFieldNaming.CheckLocalisation(evt["Target_Localised"].Str(), Target);  // 3.7 added a localised target field, so try it

                var sp = ShipModuleData.Instance.GetShipProperties(Target);
                if (sp != null)
                {
                    TargetLocalised = ((ShipModuleData.ShipInfoString)sp[ShipModuleData.ShipPropID.Name]).Value;
                }
            }


            if (Rewards == null)                    // for skimmers, its Faction/Reward.  Bug in manual reported to FD 23/5/2018
            {
                string faction = evt["Faction"].StrNull();
                long?  reward  = evt["Reward"].IntNull();

                if (faction != null && reward != null)
                {
                    Rewards    = new BountyReward[1];
                    Rewards[0] = new BountyReward()
                    {
                        Faction = faction, Reward = reward.Value
                    };
                    TotalReward = reward.Value;
                }
            }
        }