Class ConvoyService
- java.lang.Object
-
- ch.sahits.game.openpatrician.clientserverinterface.service.ConvoyService
-
public class ConvoyService extends java.lang.Object
Service for various actions around convoys.- Author:
- Andi Hotz, (c) Sahits GmbH, 2018 Created on Sep 23, 2018
-
-
Field Summary
Fields Modifier and Type Field Description private com.google.common.eventbus.AsyncEventBus
clientServerEventBus
private ConvoyList
convoyList
private Date
date
private OutriggerService
outriggerService
private ShipFactory
shipFactory
private ShipService
shipService
private ClientServerTaskFactory
taskFactory
private TimedUpdatableTaskList
taskList
-
Constructor Summary
Constructors Constructor Description ConvoyService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IConvoy
create(IShip orleg, boolean publicConvoy)
Create a new convoy.java.util.List<IShip>
dissolve(IConvoy convoy, ICity city)
Dissolving a convoy.void
join(IConvoy convoy, IShip ship)
Ship joining an existing convoy.void
leave(IConvoy convoy, IShip ship)
Ship leaving a convoy.java.util.Optional<IShip>
outfitAsOrleg(IShip ship, ICity city)
Outfit a ship to be orleg capable.
-
-
-
Field Detail
-
clientServerEventBus
@Autowired @Qualifier("serverClientEventBus") private com.google.common.eventbus.AsyncEventBus clientServerEventBus
-
shipFactory
@Autowired private ShipFactory shipFactory
-
convoyList
@Autowired private ConvoyList convoyList
-
outriggerService
@Autowired private OutriggerService outriggerService
-
shipService
@Autowired private ShipService shipService
-
taskFactory
@Autowired @Qualifier("serverSideTaskFactory") private ClientServerTaskFactory taskFactory
-
taskList
@Autowired private TimedUpdatableTaskList taskList
-
date
@Autowired private Date date
-
-
Method Detail
-
join
public void join(IConvoy convoy, IShip ship)
Ship joining an existing convoy.- Parameters:
convoy
- that is joinedship
- joining ship
-
leave
public void leave(IConvoy convoy, IShip ship)
Ship leaving a convoy.- Parameters:
convoy
- that is left.ship
- leafing ship
-
dissolve
public java.util.List<IShip> dissolve(IConvoy convoy, ICity city)
Dissolving a convoy.- Parameters:
convoy
- that is being dissolved- Returns:
- list of all the ships that were part of the convoy.
-
create
public IConvoy create(IShip orleg, boolean publicConvoy)
Create a new convoy.- Parameters:
orleg
- ship of the convoypublicConvoy
- flag indicating if it is a public or private convoy.- Returns:
- newly created convoy.
-
outfitAsOrleg
public java.util.Optional<IShip> outfitAsOrleg(IShip ship, ICity city)
Outfit a ship to be orleg capable. This means required weapon strength and enouth sailors. Should the outfitting be possible on the spot, the outfitted ship is returned, otherwise outfitting is scheduled and empty is returned.- Parameters:
ship
- to be outfittedcity
- where is to be outfitted- Returns:
- outfitted ship or empty if the ship cannot be outfitted or outfitting is scheduled.
-
-