Example #1
0
 internal FsdJumpEvent InvokeEvent(FsdJumpEvent arg)
 {
     if (_api.ValidateEvent(arg))
     {
         FsdJump?.Invoke(_api, arg);
     }
     return(arg);
 }
Example #2
0
        private void AssertEvent(FsdJumpEvent @event)
        {
            Assert.NotNull(@event);
            Assert.Equal(DateTime.Parse("2019-08-31T11:56:05Z"), @event.Timestamp);
            Assert.Equal(EventName, @event.Event);
            Assert.Equal("Nanabozho", @event.StarSystem);
            Assert.Equal(2832698675930, @event.SystemAddress);
            Assert.Equal(22.93750, @event.StarPos[0], 5);
            Assert.Equal(-35.75000, @event.StarPos[1], 5);
            Assert.Equal(24.15625, @event.StarPos[2], 5);
            Assert.Equal(Allegiance.Independent, @event.SystemAllegiance);
            Assert.Equal("$economy_HighTech;", @event.SystemEconomy);
            Assert.Equal(EconomyType.HighTech, @event.SystemEconomyType);
            Assert.Equal("Высокие технологии", @event.SystemEconomyLocalised);
            Assert.Equal("$economy_Refinery;", @event.SystemSecondEconomy);
            Assert.Equal(EconomyType.Refinery, @event.SystemSecondEconomyType);
            Assert.Equal("Переработка", @event.SystemSecondEconomyLocalised);
            Assert.Equal("$government_Dictatorship;", @event.SystemGovernment);
            Assert.Equal(GovernmentType.Dictatorship, @event.SystemGovernmentType);
            Assert.Equal("Диктатура", @event.SystemGovernmentLocalised);
            Assert.Equal("$SYSTEM_SECURITY_medium;", @event.SystemSecurity);
            Assert.Equal(SecurityType.Medium, @event.SystemSecurityType);
            Assert.Equal("Средн. ур. безопасности", @event.SystemSecurityLocalised);
            Assert.Equal(4488711, @event.Population);
            Assert.Equal("Nanabozho A", @event.Body);
            Assert.Equal(1, @event.BodyId);
            Assert.Equal(BodyType.Star, @event.BodyType);
            Assert.Equal(8.451, @event.JumpDist, 3);
            Assert.Equal(0.596440, @event.FuelUsed, 6);
            Assert.Equal(7.010800, @event.FuelLevel, 6);
            Assert.Equal("EG Union", @event.SystemFaction.Name);
            Assert.Equal("Expansion", @event.SystemFaction.State);

            Assert.Equal(8, @event.Factions.Length);
            Assert.Equal("Nanabozho Transport Holdings", @event.Factions[0].Name);
            Assert.Equal("CivilWar", @event.Factions[0].State);
            Assert.Equal("Corporate", @event.Factions[0].Government);
            Assert.Equal(GovernmentType.Corporate, @event.Factions[0].GovernmentType);
            Assert.Equal(0.105578, @event.Factions[0].Influence, 6);
            Assert.Equal(Allegiance.Federation, @event.Factions[0].Allegiance);
            Assert.Equal(Happiness.Happy, @event.Factions[0].Happiness);
            Assert.Equal("Счастье", @event.Factions[0].HappinessLocalised);
            Assert.Equal(0.000000, @event.Factions[0].MyReputation, 6);
            Assert.Single(@event.Factions[0].ActiveStates);
            Assert.Equal(State.CivilWar, @event.Factions[0].ActiveStates[0].State);

            Assert.Single(@event.Conflicts);
            Assert.Equal("civilwar", @event.Conflicts[0].WarType);
            Assert.Equal("active", @event.Conflicts[0].Status);
            Assert.Equal("Nanabozho Transport Holdings", @event.Conflicts[0].Faction1.Name);
            Assert.Equal("Patrick Depot", @event.Conflicts[0].Faction1.Stake);
            Assert.Equal(2, @event.Conflicts[0].Faction1.WonDays);
            Assert.Equal("Elite Orange Cross", @event.Conflicts[0].Faction2.Name);
            Assert.Equal(string.Empty, @event.Conflicts[0].Faction2.Stake);
            Assert.Equal(0, @event.Conflicts[0].Faction2.WonDays);
        }
        private async void TravelOnFsdJumpAsync(object sender, FsdJumpEvent e)
        {
            var request = StartRequest();

            if (e.Factions != null && e.Factions.Length > 0)
            {
                foreach (var faction in e.Factions)
                {
                    request.AddCommand(new SetCommanderReputationMinorFaction(faction.Name, faction.MyReputation));
                }
            }

            request.AddCommand(new AddCommanderTravelFsdJump(e.StarSystem)
            {
                JumpDistance = e.JumpDist,
                ShipType     = _eliteAPI.Ship?.ShipType,
                ShipId       = _eliteAPI.Ship?.ShipId
            });

            await request.SendAsync().ConfigureAwait(false);
        }
Example #4
0
 internal void InvokeFsdJumpEvent(FsdJumpEvent arg)
 {
     FsdJumpEvent?.Invoke(this, arg);
 }