コード例 #1
0
 private void handleCommoditySoldEvent(CommoditySoldEvent @event)
 {
     if (_handleCommoditySoldEvent(@event))
     {
         writeInventory();
     }
 }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
 private void handleCommoditySoldEvent(CommoditySoldEvent @event)
 {
     if (@event.timestamp > updateDat)
     {
         if (_handleCommoditySoldEvent(@event))
         {
             updateDat = @event.timestamp;
             writeInventory();
         }
     }
 }
コード例 #4
0
        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);
        }
コード例 #5
0
 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;
         }
     }
 }
コード例 #6
0
 private void handleCommoditySoldEvent(CommoditySoldEvent @event)
 {
     _handleCommoditySoldEvent(@event);
     writeInventory();
 }