private void handleCommodityPurchasedEvent(CommodityPurchasedEvent @event) { if (_handleCommodityPurchasedEvent(@event)) { writeInventory(); } }
private void handleCommodityPurchasedEvent(CommodityPurchasedEvent @event) { if (@event.timestamp > updateDat) { updateDat = @event.timestamp; if (_handleCommodityPurchasedEvent(@event)) { writeInventory(); } } }
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); } }
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); }
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); }