Ejemplo n.º 1
0
        private void _handleBountyAwardedEvent(BountyAwardedEvent @event, bool test = false)
        {
            // 20% bonus for Arissa Lavigny-Duval 'controlled' and 'exploited' systems
            StarSystem currentSystem = EDDI.Instance?.CurrentStarSystem;

            if (currentSystem != null)
            {
                currentSystem = LegacyEddpService.SetLegacyData(currentSystem, true, false, false);
            }

            // Default to 1.0 for unit testing
            double bonus = (!test && currentSystem?.Power == Power.FromEDName("ALavignyDuval")) ? 1.2 : 1.0;

            // Get the victim faction data
            Faction faction = bgsService.GetFactionByName(@event.faction);

            foreach (Reward reward in @event.rewards.ToList())
            {
                int           shipId = EDDI.Instance?.CurrentShip?.LocalId ?? 0;
                long          amount = Convert.ToInt64(reward.amount * bonus);
                FactionReport report = new FactionReport(@event.timestamp, true, shipId, Crime.None, currentSystem?.systemname, amount)
                {
                    station          = EDDI.Instance?.CurrentStation?.name,
                    body             = EDDI.Instance?.CurrentStellarBody?.bodyname,
                    victim           = @event.faction,
                    victimAllegiance = (faction.Allegiance ?? Superpower.None).invariantName
                };

                FactionRecord record = GetRecordWithFaction(reward.faction)
                                       ?? AddRecord(reward.faction);
                record.factionReports.Add(report);
                record.claims += amount;
            }
        }
Ejemplo n.º 2
0
 private void handleBountyAwardedEvent(BountyAwardedEvent @event)
 {
     if (@event.timestamp > updateDat)
     {
         updateDat = @event.timestamp;
         _handleBountyAwardedEvent(@event);
         writeRecord();
     }
 }
Ejemplo n.º 3
0
 private void handleBountyAwardedEvent(BountyAwardedEvent @event)
 {
     if (@event.timestamp > updateDat || (@event.timestamp == updateDat && [email protected]))
     {
         updateDat = @event.timestamp;
         _handleBountyAwardedEvent(@event);
         writeRecord();
     }
 }