示例#1
0
 private void handleCommodityPurchasedEvent(CommodityPurchasedEvent @event)
 {
     if (_handleCommodityPurchasedEvent(@event))
     {
         writeInventory();
     }
 }
示例#2
0
 private void handleCommodityPurchasedEvent(CommodityPurchasedEvent @event)
 {
     if (@event.timestamp > updateDat)
     {
         updateDat = @event.timestamp;
         if (_handleCommodityPurchasedEvent(@event))
         {
             writeInventory();
         }
     }
 }
示例#3
0
        public void _handleCommodityPurchasedEvent(CommodityPurchasedEvent @event)
        {
            Cargo cargo = GetCargoWithEDName(@event.commodityDefinition?.edname);

            if (cargo != null)
            {
                cargo.owned += @event.amount;
                cargo.CalculateNeed();
            }
            else
            {
                Cargo newCargo = new Cargo(@event.commodityDefinition?.edname, @event.amount, @event.price);
                newCargo.haulage = 0;
                newCargo.stolen  = 0;
                newCargo.owned   = @event.amount;
                AddCargo(newCargo);
            }
        }
示例#4
0
        private bool _handleCommodityPurchasedEvent(CommodityPurchasedEvent @event)
        {
            bool  update = false;
            Cargo cargo  = GetCargoWithEDName(@event.commodityDefinition?.edname);

            if (cargo != null)
            {
                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;
                    update = true;
                }
            }
            return(update);
        }
示例#5
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);
        }