Class BaseBuyTradeStep

  • All Implemented Interfaces:
    ITradeStep
    Direct Known Subclasses:
    BuyTradeStep, CheckedBuyTradeStep

    public abstract class BaseBuyTradeStep
    extends java.lang.Object
    implements ITradeStep
    Base class providing common functionality.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2017 Created on Oct 17, 2017
    • Field Detail

      • tradeService

        @Autowired
        private TradeService tradeService
      • city

        private ICity city
      • ware

        private IWare ware
      • maxBuyPrice

        private int maxBuyPrice
      • retainCash

        private long retainCash
    • Constructor Detail

      • BaseBuyTradeStep

        public BaseBuyTradeStep()
    • Method Detail

      • transferFromOfficeOrBuyFromCity

        protected long transferFromOfficeOrBuyFromCity​(IPlayer player,
                                                       int maxAmount)
        Try transferring the required amount from storage if there is a store manager and the transfer is allowed. The rest is then bought from the city.
        Parameters:
        player - for which the transfer happens
        maxAmount - maximum amount of wares that should be loaded onto the vessel.
        Returns:
        cost of the wares.