private void handleCommoditySoldEvent(CommoditySoldEvent @event) { if (_handleCommoditySoldEvent(@event)) { writeInventory(); } }
public void _handleCommoditySoldEvent(CommoditySoldEvent @event) { Cargo cargo = GetCargoWithEDName(@event.commodityDefinition?.edname); if (cargo != null) { if (@event.stolen) { // Cargo is stolen cargo.stolen -= Math.Min(cargo.stolen, @event.amount); } else if (@event.blackmarket && [email protected]) { // Assume cargo is mission-related int amount = Math.Min(cargo.haulage, @event.amount); cargo.haulage -= amount; cargo.ejected += amount; } else { // Cargo is owned by the commander cargo.owned -= Math.Min(cargo.owned, @event.amount); } RemoveCargo(cargo); } }
private void handleCommoditySoldEvent(CommoditySoldEvent @event) { if (@event.timestamp > updateDat) { if (_handleCommoditySoldEvent(@event)) { updateDat = @event.timestamp; writeInventory(); } } }
private bool _handleCommoditySoldEvent(CommoditySoldEvent @event) { bool update = false; Cargo cargo = GetCargoWithEDName(@event.commodityDefinition?.edname); if (cargo != null) { // Flag event to check for a failed mission in following 'Cargo' event checkHaulage = true; } return(update); }
private void handleCommoditySoldEvent(CommoditySoldEvent @event) { if (@event.timestamp > updateDat) { updateDat = @event.timestamp; Cargo cargo = GetCargoWithEDName(@event.commodityDefinition?.edname); if (cargo != null) { // Flag event to check whether haulage was sold in following 'Cargo' event checkHaulage = true; } } }
private void handleCommoditySoldEvent(CommoditySoldEvent @event) { _handleCommoditySoldEvent(@event); writeInventory(); }