Class ServerSideTaskFactory


  • @Service
    @Lazy
    @DependentInitialisation(ch.sahits.game.openpatrician.model.initialisation.StartNewGameBean.class)
    public class ServerSideTaskFactory
    extends ch.sahits.game.openpatrician.clientserverinterface.service.ClientServerTaskFactory
    Author:
    Andi Hotz, (c) Sahits GmbH, 2014 Created on Mar 01, 2014
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ch.sahits.game.openpatrician.model.event.TimedTask getAIShipRefitTask​(java.time.LocalDateTime dueDate, ch.sahits.game.openpatrician.model.ship.IShip ship, ch.sahits.game.openpatrician.model.ship.EShipUpgrade upgrade, ch.sahits.game.openpatrician.model.city.IShipyard shipyard)
      Retrieve the refit task for an AI ship.
      ch.sahits.game.openpatrician.model.event.TimedTask getAIShipRepairTask​(java.time.LocalDateTime dueDate, ch.sahits.game.openpatrician.model.ship.IShip ship, ch.sahits.game.openpatrician.model.city.IShipyard shipyard)
      Retrieve the repair task for an AI ship.
      ChurchUpgradeTimedTask getChurchUpgradeTask​(ch.sahits.game.openpatrician.model.city.IChurch church, java.time.LocalDateTime deadline)
      Create the timed task for the church upgrade.
      ClearCityEventTask getClearCityEventTask​(java.time.LocalDateTime executionTime, ch.sahits.game.openpatrician.model.city.ICity city)
      Retrieve the timed task to clear the city event.
      ch.sahits.game.openpatrician.model.event.TimedTask getDailyAIPlayerCheck()
      Retrieve the daily check for the AI player
      LoanerCollectMoneyAfterAuctionTimedTask getLoanerCollectMoneyAfterAuctionTask​(ch.sahits.game.openpatrician.model.city.impl.IDebt debt, java.time.LocalDateTime deadline)
      Create the timed task for the loaner to collect money from the debitor after an auction.
      LoanerCollectMoneyWithoutAuctionTimedTask getLoanerCollectMoneyTask​(ch.sahits.game.openpatrician.model.city.impl.IDebt debt, ch.sahits.game.openpatrician.model.IPlayer debitor, java.time.LocalDateTime deadline)
      Create a timed task for the loaner to collect money.
      MarriageOfferDeclinedTimedTask getMarriageOfferDeclinedTask​(ch.sahits.game.openpatrician.model.IPlayer player)
      Retrieve the timed task for the declined marriage offer.
      MarriageOfferTask getMarriageOfferTask​(ch.sahits.game.openpatrician.model.IAIPlayer player, ch.sahits.game.openpatrician.clientserverinterface.model.event.MarriageBrokerAnnouncementState state, java.time.LocalDateTime deadLine)
      Retrieve a timed task for the marriage offer.
      ch.sahits.game.openpatrician.model.event.TimedTask getPeriodicalDailyUpdateTask()
      Update task that issues a PeriodicalDailyUpdate event on the event bus.
      ch.sahits.game.openpatrician.model.event.TimedTask getPirateRepairTask​(java.time.LocalDateTime dueDate, ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel, ch.sahits.game.openpatrician.model.people.ISeaPirate owner, ch.sahits.game.openpatrician.model.city.IShipyard shipyard)
      Retrieve the repair task for a pirate vessel
      PostStateDialogToHumanPlayerTask getPostStateDialogMessageTask​(java.time.LocalDateTime executionTime, ch.sahits.game.openpatrician.model.EMessageCategory category, ch.sahits.game.openpatrician.model.ui.IDialogState state, ch.sahits.game.openpatrician.model.IPlayer player, java.lang.String messageKey, java.lang.Object[] messageParams)
      Retrieve the timed task to post a state based dialog message if the player is human.
      ch.sahits.game.openpatrician.model.event.TimedTask getRefitShipTask​(java.time.LocalDateTime executionTime, ch.sahits.game.openpatrician.model.ship.IShip ship, ch.sahits.game.openpatrician.model.ship.EShipUpgrade upgrade, ch.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX proxy, ch.sahits.game.openpatrician.model.city.IShipyard shipyard)
      Retrieve the ship refit task.
      ch.sahits.game.openpatrician.model.event.TimedTask getRepairTask​(java.time.LocalDateTime executionTime, ch.sahits.game.openpatrician.model.ship.IShip ship, ch.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX proxy, ch.sahits.game.openpatrician.model.city.IShipyard shipyard)
      Retrieve the ship repair task.
      ch.sahits.game.openpatrician.model.city.impl.IShipBuildTask getShipBuildTask​(java.time.LocalDateTime executionTime, ch.sahits.game.openpatrician.model.ship.EShipType type, ch.sahits.game.openpatrician.model.IPlayer owner, javafx.geometry.Point2D location, ch.sahits.game.openpatrician.model.city.IShipyard shipyard)
      Retrieve the ship build task.
      UpdatePopulationTask getUpdatePopulationTask​(java.time.LocalDateTime executionTime, ch.sahits.game.openpatrician.model.city.EPopulationClass populationClass, int delta, ch.sahits.game.openpatrician.model.city.ICity city)
      Retrieve the timed task to update the population of a certain class.
      WeaponConstructionTask getWeaponConstructionFinishedTask​(ch.sahits.game.openpatrician.model.weapon.IArmory armory, ch.sahits.game.openpatrician.model.weapon.EWeapon weapon)
      Retrieve the timed task for finishing a weapon construction.
      ch.sahits.game.openpatrician.model.event.TimedTask getWeeklyCityCheck()
      Retrieve a weekly city check task.
      ch.sahits.game.openpatrician.model.event.TimedTask getWeeklyLoanerCheck()
      Retrieve a weekly loaner check task.
      WaitForShipArrival waitForShipArrival​(ch.sahits.game.openpatrician.model.ship.INavigableVessel waitingVessel, ch.sahits.game.openpatrician.model.ship.INavigableVessel waitingOnVessel, ch.sahits.game.openpatrician.model.city.ICity waitingIn, java.lang.Runnable actionUponArrival, boolean waitingShipArrived)
      Retrieve the task for a ship to wait until another ship and itself arrived at the same destination city.
      • Methods inherited from class ch.sahits.game.openpatrician.clientserverinterface.service.ClientServerTaskFactory

        getCelebrationEvent, getMarriageCelebrationEvent, getReschedulableSailorHireTask, getReschedulableWeaponBuyTask
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ServerSideTaskFactory

        public ServerSideTaskFactory()
    • Method Detail

      • getRepairTask

        public ch.sahits.game.openpatrician.model.event.TimedTask getRepairTask​(java.time.LocalDateTime executionTime,
                                                                                ch.sahits.game.openpatrician.model.ship.IShip ship,
                                                                                ch.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX proxy,
                                                                                ch.sahits.game.openpatrician.model.city.IShipyard shipyard)
        Retrieve the ship repair task.
        Returns:
        ship repair task
      • getShipBuildTask

        public ch.sahits.game.openpatrician.model.city.impl.IShipBuildTask getShipBuildTask​(java.time.LocalDateTime executionTime,
                                                                                            ch.sahits.game.openpatrician.model.ship.EShipType type,
                                                                                            ch.sahits.game.openpatrician.model.IPlayer owner,
                                                                                            javafx.geometry.Point2D location,
                                                                                            ch.sahits.game.openpatrician.model.city.IShipyard shipyard)
        Retrieve the ship build task.
        Returns:
        ship build task
      • getRefitShipTask

        public ch.sahits.game.openpatrician.model.event.TimedTask getRefitShipTask​(java.time.LocalDateTime executionTime,
                                                                                   ch.sahits.game.openpatrician.model.ship.IShip ship,
                                                                                   ch.sahits.game.openpatrician.model.ship.EShipUpgrade upgrade,
                                                                                   ch.sahits.game.openpatrician.clientserverinterface.client.ICityPlayerProxyJFX proxy,
                                                                                   ch.sahits.game.openpatrician.model.city.IShipyard shipyard)
        Retrieve the ship refit task.
        Returns:
        ship refit task
      • getPirateRepairTask

        public ch.sahits.game.openpatrician.model.event.TimedTask getPirateRepairTask​(java.time.LocalDateTime dueDate,
                                                                                      ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel,
                                                                                      ch.sahits.game.openpatrician.model.people.ISeaPirate owner,
                                                                                      ch.sahits.game.openpatrician.model.city.IShipyard shipyard)
        Retrieve the repair task for a pirate vessel
        Parameters:
        dueDate - execution time
        vessel - vessel to be repaired
        owner - pirate owner
        Returns:
        special repair task
      • getAIShipRepairTask

        public ch.sahits.game.openpatrician.model.event.TimedTask getAIShipRepairTask​(java.time.LocalDateTime dueDate,
                                                                                      ch.sahits.game.openpatrician.model.ship.IShip ship,
                                                                                      ch.sahits.game.openpatrician.model.city.IShipyard shipyard)
        Retrieve the repair task for an AI ship.
        Parameters:
        dueDate - execution time
        ship - to be repaired
        Returns:
        repair task for AI ships
      • getAIShipRefitTask

        public ch.sahits.game.openpatrician.model.event.TimedTask getAIShipRefitTask​(java.time.LocalDateTime dueDate,
                                                                                     ch.sahits.game.openpatrician.model.ship.IShip ship,
                                                                                     ch.sahits.game.openpatrician.model.ship.EShipUpgrade upgrade,
                                                                                     ch.sahits.game.openpatrician.model.city.IShipyard shipyard)
        Retrieve the refit task for an AI ship.
        Parameters:
        dueDate - execution time
        ship - to be upgraded
        Returns:
        upgrade task for AI ships
      • getWeeklyLoanerCheck

        public ch.sahits.game.openpatrician.model.event.TimedTask getWeeklyLoanerCheck()
        Retrieve a weekly loaner check task.
        Returns:
        weekly loaner check task
      • getDailyAIPlayerCheck

        public ch.sahits.game.openpatrician.model.event.TimedTask getDailyAIPlayerCheck()
        Retrieve the daily check for the AI player
        Returns:
        daily AI player update task
      • getPeriodicalDailyUpdateTask

        public ch.sahits.game.openpatrician.model.event.TimedTask getPeriodicalDailyUpdateTask()
        Update task that issues a PeriodicalDailyUpdate event on the event bus.
        Returns:
        Daily update task
      • getWeeklyCityCheck

        public ch.sahits.game.openpatrician.model.event.TimedTask getWeeklyCityCheck()
        Retrieve a weekly city check task.
        Returns:
        weekly city check task
      • getMarriageOfferTask

        public MarriageOfferTask getMarriageOfferTask​(ch.sahits.game.openpatrician.model.IAIPlayer player,
                                                      ch.sahits.game.openpatrician.clientserverinterface.model.event.MarriageBrokerAnnouncementState state,
                                                      java.time.LocalDateTime deadLine)
        Retrieve a timed task for the marriage offer.
        Parameters:
        player - that is addressed
        state - of the marraiage offer announcement
        deadLine - when the offer will happen.
        Returns:
        timed task to be submitted to the timed task list.
      • getChurchUpgradeTask

        public ChurchUpgradeTimedTask getChurchUpgradeTask​(ch.sahits.game.openpatrician.model.city.IChurch church,
                                                           java.time.LocalDateTime deadline)
        Create the timed task for the church upgrade.
        Parameters:
        church - to be upgreaded
        deadline - when it will happen
        Returns:
        timed task to be supplied to the timed task list.
      • getLoanerCollectMoneyAfterAuctionTask

        public LoanerCollectMoneyAfterAuctionTimedTask getLoanerCollectMoneyAfterAuctionTask​(ch.sahits.game.openpatrician.model.city.impl.IDebt debt,
                                                                                             java.time.LocalDateTime deadline)
        Create the timed task for the loaner to collect money from the debitor after an auction.
        Parameters:
        debt - debt contract
        deadline - when this will happen.
        Returns:
        timed task to be supplied to the timed task list.
      • getLoanerCollectMoneyTask

        public LoanerCollectMoneyWithoutAuctionTimedTask getLoanerCollectMoneyTask​(ch.sahits.game.openpatrician.model.city.impl.IDebt debt,
                                                                                   ch.sahits.game.openpatrician.model.IPlayer debitor,
                                                                                   java.time.LocalDateTime deadline)
        Create a timed task for the loaner to collect money.
        Parameters:
        debt - debt contract
        debitor - from whom to collect the money.
        deadline - when this will happen.
        Returns:
        timed task to be supplied to the timed task list.
      • getMarriageOfferDeclinedTask

        public MarriageOfferDeclinedTimedTask getMarriageOfferDeclinedTask​(ch.sahits.game.openpatrician.model.IPlayer player)
        Retrieve the timed task for the declined marriage offer.
        Parameters:
        player - who declined the offer.
        Returns:
        timed task to be supplied to the timed task list.
      • getWeaponConstructionFinishedTask

        public WeaponConstructionTask getWeaponConstructionFinishedTask​(ch.sahits.game.openpatrician.model.weapon.IArmory armory,
                                                                        ch.sahits.game.openpatrician.model.weapon.EWeapon weapon)
        Retrieve the timed task for finishing a weapon construction.
        Parameters:
        armory - in which the weapon was buildt
        weapon - type that was built.
        Returns:
        timed task to be supplied to the timed task list.
      • getUpdatePopulationTask

        public UpdatePopulationTask getUpdatePopulationTask​(java.time.LocalDateTime executionTime,
                                                            ch.sahits.game.openpatrician.model.city.EPopulationClass populationClass,
                                                            int delta,
                                                            ch.sahits.game.openpatrician.model.city.ICity city)
        Retrieve the timed task to update the population of a certain class.
        Parameters:
        executionTime - when the task is to be executed.
        populationClass - population class to be updated
        delta - of the population change (can be negative)
        city - in which the population should be updated.
        Returns:
        timed task for the population update.
      • getClearCityEventTask

        public ClearCityEventTask getClearCityEventTask​(java.time.LocalDateTime executionTime,
                                                        ch.sahits.game.openpatrician.model.city.ICity city)
        Retrieve the timed task to clear the city event.
        Parameters:
        executionTime - when the task is to be executed.
        city - for which the event is to be cleared.
        Returns:
        timed task for the event clearing.
      • getPostStateDialogMessageTask

        public PostStateDialogToHumanPlayerTask getPostStateDialogMessageTask​(java.time.LocalDateTime executionTime,
                                                                              ch.sahits.game.openpatrician.model.EMessageCategory category,
                                                                              ch.sahits.game.openpatrician.model.ui.IDialogState state,
                                                                              ch.sahits.game.openpatrician.model.IPlayer player,
                                                                              java.lang.String messageKey,
                                                                              java.lang.Object[] messageParams)
        Retrieve the timed task to post a state based dialog message if the player is human.
        Parameters:
        executionTime - when the task is to be executed.
        category - into which the message is posted.
        state - on which the dialog is based
        player - for which the dialog is to be posted
        messageKey - key of the dialog
        messageParams - message parameters
        Returns:
        timed task for the state based display of a dialog.
      • waitForShipArrival

        public WaitForShipArrival waitForShipArrival​(ch.sahits.game.openpatrician.model.ship.INavigableVessel waitingVessel,
                                                     ch.sahits.game.openpatrician.model.ship.INavigableVessel waitingOnVessel,
                                                     ch.sahits.game.openpatrician.model.city.ICity waitingIn,
                                                     java.lang.Runnable actionUponArrival,
                                                     boolean waitingShipArrived)
        Retrieve the task for a ship to wait until another ship and itself arrived at the same destination city.
        Parameters:
        waitingVessel - vessel that is waiting on the other vessel
        waitingOnVessel - other vessel on which is waited for.
        waitingIn - destination city, where both vessels should arrive
        actionUponArrival - action that is executed, when both ships are present at the destination
        waitingShipArrived - flag indicating that the waiting vessel is already present at the destination.
        Returns:
        the task