Exemplo n.º 1
0
 internal MissionAbandonedEvent InvokeEvent(MissionAbandonedEvent arg)
 {
     if (_api.ValidateEvent(arg))
     {
         MissionAbandoned?.Invoke(_api, arg);
     }
     return(arg);
 }
Exemplo n.º 2
0
 private static void AssertEvent(MissionAbandonedEvent @event)
 {
     Assert.NotNull(@event);
     Assert.Equal(DateTime.Parse("2016-06-10T14:32:03Z"), @event.Timestamp);
     Assert.Equal(EventName, @event.Event);
     Assert.Equal(65343025, @event.MissionId);
     Assert.Equal("Mission_Collect_name", @event.Name);
     Assert.Equal(0, @event.Fine);
 }
Exemplo n.º 3
0
        private bool _handleMissionAbandonedEvent(MissionAbandonedEvent @event)
        {
            bool update = false;

            if (@event.fine > 0 && @event.missionid != null)
            {
                update = handleMissionFine(@event.timestamp, @event.missionid ?? 0, @event.fine);
            }
            return(update);
        }
Exemplo n.º 4
0
 private void handleMissionAbandonedEvent(MissionAbandonedEvent @event)
 {
     if (@event.timestamp > updateDat)
     {
         updateDat = @event.timestamp;
         if (_handleMissionAbandonedEvent(@event))
         {
             writeInventory();
         }
     }
 }
Exemplo n.º 5
0
 private void handleMissionAbandonedEvent(MissionAbandonedEvent @event)
 {
     if (@event.timestamp > updateDat || (@event.timestamp == updateDat && [email protected]))
     {
         updateDat = @event.timestamp;
         if (_handleMissionAbandonedEvent(@event))
         {
             writeRecord();
         }
     }
 }
Exemplo n.º 6
0
        private void _handleMissionAbandonedEvent(MissionAbandonedEvent @event)
        {
            Haulage haulage = GetHaulageWithMissionId(@event.missionid ?? 0);

            if (haulage != null)
            {
                Cargo cargo   = GetCargoWithMissionId(@event.missionid ?? 0);
                int   onboard = haulage.remaining - haulage.need;
                cargo.haulage -= onboard;
                cargo.stolen  += onboard;
                cargo.haulageData.Remove(haulage);
                RemoveCargo(cargo);
            }
        }
Exemplo n.º 7
0
        private bool _handleMissionAbandonedEvent(MissionAbandonedEvent @event)
        {
            bool    update  = false;
            Haulage haulage = GetHaulageWithMissionId(@event.missionid ?? 0);

            if (haulage != null)
            {
                Cargo cargo   = GetCargoWithMissionId(@event.missionid ?? 0);
                int   onboard = haulage.remaining - haulage.need;
                cargo.RemoveDetailedQty(CargoType.haulage, onboard, @event.missionid);
                cargo.AddDetailedQty(CargoType.stolen, onboard, cargo.price);
                RemoveCargo(cargo);
                update = true;
            }
            return(update);
        }
Exemplo n.º 8
0
        private bool _handleMissionAbandonedEvent(MissionAbandonedEvent @event)
        {
            bool    update  = false;
            Haulage haulage = GetHaulageWithMissionId(@event.missionid ?? 0);

            if (haulage != null)
            {
                Cargo cargo   = GetCargoWithMissionId(@event.missionid ?? 0);
                int   onboard = haulage.remaining - haulage.need;
                cargo.haulage -= onboard;
                cargo.stolen  += onboard;
                cargo.haulageData.Remove(haulage);
                RemoveCargo(cargo);
                update = true;
            }
            return(update);
        }
Exemplo n.º 9
0
        public void _handleMissionAbandonedEvent(MissionAbandonedEvent @event)
        {
            foreach (Cargo inventoryCargo in inventory)
            {
                HaulageAmount haulageAmount = inventoryCargo.haulageamounts.FirstOrDefault(ha => ha.id == @event.missionid);
                if (haulageAmount != null)
                {
                    string type = @event.name.Split('_').ElementAtOrDefault(1).ToLowerInvariant();
                    switch (type)
                    {
                    case "delivery":
                    case "deliverywing":
                    case "rescue":
                    case "salvage":
                    case "smuggle":
                    {
                        // Calculate the amount of mission-related cargo still in inventory
                        int obtained = haulageAmount.amount - inventoryCargo.ejected;
                        obtained = Math.Min(inventoryCargo.haulage, obtained);

                        // Convert that amount of cargo from `haulage` to `stolen`
                        inventoryCargo.haulage -= obtained;
                        inventoryCargo.stolen  += obtained;

                        // Reduce our `need` counter by the amount of mission related cargo which had not yet been obtained.
                        inventoryCargo.need -= (haulageAmount.amount - obtained);

                        // We didn't fail for ejecting cargo so we set this counter to zero
                        inventoryCargo.ejected = 0;
                    }
                    break;
                    }
                    inventoryCargo.haulageamounts.Remove(haulageAmount);

                    RemoveCargo(inventoryCargo);
                    break;
                }
            }
        }
Exemplo n.º 10
0
 private void MissionAbandonedCallback(MissionAbandonedEvent obj)
 {
 }
Exemplo n.º 11
0
 internal void InvokeMissionAbandonedEvent(MissionAbandonedEvent arg)
 {
     MissionAbandonedEvent?.Invoke(this, arg);
 }
Exemplo n.º 12
0
 private void handleMissionAbandonedEvent(MissionAbandonedEvent @event)
 {
     _handleMissionAbandonedEvent(@event);
     writeInventory();
 }
Exemplo n.º 13
0
        public void Handle(Event theEvent)
        {
            if (EDDI.Instance.inCQC)
            {
                // We don't do anything whilst in CQC
                return;
            }

            if (theEvent is MissionAcceptedEvent)
            {
                MissionAcceptedEvent newMissionEvent = (MissionAcceptedEvent)theEvent;
                if (newMissionEvent.missionid.HasValue)
                {
                    mViewModel.addMission(newMissionEvent);
                }
            }
            else if (theEvent is MissionCompletedEvent)
            {
                MissionCompletedEvent missionEndedEvent = (MissionCompletedEvent)theEvent;
                if (missionEndedEvent.missionid.HasValue)
                {
                    mViewModel.removeMission(missionEndedEvent.missionid);
                }
            }
            else if (theEvent is MissionAbandonedEvent)
            {
                MissionAbandonedEvent missionEndedEvent = (MissionAbandonedEvent)theEvent;
                mViewModel.removeMission(missionEndedEvent.missionid);
            }

            else if (theEvent is CommodityPurchasedEvent)
            {
                var commodityEvent = (CommodityPurchasedEvent)theEvent;
                mViewModel.addCargo(commodityEvent.commodity, commodityEvent.amount);
            }
            else if (theEvent is CommoditySoldEvent)
            {
                var commodityEvent = (CommoditySoldEvent)theEvent;
                mViewModel.removeCargo(commodityEvent.commodity, commodityEvent.amount);
            }
            else if (theEvent is CommodityRefinedEvent)
            {
                var commodityEvent = (CommodityRefinedEvent)theEvent;
                mViewModel.addCargo(commodityEvent.commodity, 1);
            }
            else if (theEvent is CommodityCollectedEvent)
            {
                var commodityEvent = (CommodityCollectedEvent)theEvent;
                mViewModel.addCargo(commodityEvent.commodity, 1);
            }
            else if (theEvent is CommodityEjectedEvent)
            {
                var commodityEvent = (CommodityEjectedEvent)theEvent;
                mViewModel.removeCargo(commodityEvent.commodity, commodityEvent.amount);
            }
            else if (theEvent is MarketInformationUpdatedEvent)
            {
                var dockedEvent = (MarketInformationUpdatedEvent)theEvent;

                foreach (var mr in mViewModel.MissionRequirements)
                {
                    mr.AtCurrentStation = null;
                }

                updateStationInfo(dockedEvent);
            }
        }
Exemplo n.º 14
0
 internal void InvokeMissionAbandonedEvent(MissionAbandonedEvent arg) => MissionAbandonedEvent?.Invoke(null, arg);