Beispiel #1
0
        private bool _handleLimpetPurchasedEvent(LimpetPurchasedEvent @event)
        {
            Cargo cargo = GetCargoWithEDName("Drones") ?? new Cargo("Drones");

            cargo.AddDetailedQty(CargoType.owned, @event.amount, @event.price);
            AddOrUpdateCargo(cargo);
            return(true);
        }
Beispiel #2
0
        private bool _handleCommodityCollectedEvent(CommodityCollectedEvent @event)
        {
            bool  update = false;
            Cargo cargo  = GetCargoWithEDName(@event.commodityDefinition?.edname);

            if (cargo != null)
            {
                Haulage haulage = cargo.haulageData.FirstOrDefault(h => h.missionid == @event.missionid);
                if (EDDI.Instance?.Vehicle != Constants.VEHICLE_SHIP)
                {
                    if (haulage != null)
                    {
                        cargo.AddDetailedQty(CargoType.haulage, 1, 0);
                    }
                    else if (@event.stolen)
                    {
                        cargo.AddDetailedQty(CargoType.stolen, 1, 0);
                    }
                    else
                    {
                        cargo.AddDetailedQty(CargoType.owned, 1, 0);
                    }
                    cargo.CalculateNeed();
                    update = true;
                }
                if (haulage != null)
                {
                    switch (haulage.typeEDName)
                    {
                    case "mining":
                    case "piracy":
                    case "rescue":
                    case "salvage":
                    {
                        haulage.sourcesystem = EDDI.Instance?.CurrentStarSystem?.systemname;
                        haulage.sourcebody   = EDDI.Instance?.CurrentStellarBody?.bodyname;
                        update = true;
                    }
                    break;
                    }
                }
            }
            return(update);
        }
Beispiel #3
0
 private bool _handleSynthesisedEvent(SynthesisedEvent @event)
 {
     if (@event.synthesis.Contains("Limpet"))
     {
         Cargo cargo = GetCargoWithEDName("Drones") ?? new Cargo("Drones");
         cargo.AddDetailedQty(CargoType.owned, 4, 0);
         AddOrUpdateCargo(cargo);
         return(true);
     }
     return(false);
 }
Beispiel #4
0
        private bool _handleCommodityPurchasedEvent(CommodityPurchasedEvent @event)
        {
            Cargo   cargo   = GetCargoWithEDName(@event.commodityDefinition?.edname) ?? new Cargo(@event.commodityDefinition?.edname);
            Haulage haulage = cargo.haulageData.FirstOrDefault(h => h.typeEDName
                                                               .ToLowerInvariant()
                                                               .Contains("collect"));

            if (haulage != null)
            {
                haulage.sourcesystem = EDDI.Instance?.CurrentStarSystem?.systemname;
                haulage.sourcebody   = EDDI.Instance?.CurrentStation?.name;
                cargo.AddDetailedQty(CargoType.haulage, @event.amount, @event.price, haulage);
            }
            else
            {
                cargo.AddDetailedQty(CargoType.owned, @event.amount, @event.price);
            }
            AddOrUpdateCargo(cargo);
            return(true);
        }
Beispiel #5
0
        private bool _handleMissionFailedEvent(MissionFailedEvent @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, haulage);
                cargo.AddDetailedQty(CargoType.stolen, onboard, cargo.price);
                RemoveCargo(cargo);
                return(true);
            }
            return(update);
        }