def update_dock(dock: db.Dock, fuel: int=None, ammo: int=None, steel: int=None, baux: int=None, ship: db.AdmiralShip=None, build=True): """ Updates a dock with the correct values. Can be called just like ```update_dock(dock)``` to reset the dock. :param dock: The dock object to work on. :param fuel: The amount of fuel in the recipe. :param ammo: The amount of ammo in the recipe. :param steel: The amount of steel in the recipe. :param baux: The amount of Bauxite in the recipe. :param ship: The ship object to add to the dock. :return: """ dock.fuel = fuel dock.ammo = ammo dock.steel = steel dock.baux = baux if ship is not None: dock.cmats = 1 try: if build: ntime = util.millisecond_timestamp( datetime.datetime.now() + datetime.timedelta(minutes=ship.ship.buildtime)) else: ntime = util.millisecond_timestamp( datetime.datetime.now() + datetime.timedelta(minutes=ShipHelper.get_repair_time(ship))) except TypeError: ntime = util.millisecond_timestamp(datetime.datetime.now() + datetime.timedelta(minutes=22)) dock.complete = ntime else: dock.cmats = 0 dock.complete = 0 dock.ship = ship return dock
def update_dock(dock: Dock, fuel: int = None, ammo: int = None, steel: int = None, baux: int = None, ship: AdmiralShip = None, build=True): """ Updates a dock with the correct values. Can be called just like ```update_dock(dock)``` to reset the dock. :param dock: The dock object to work on. :param fuel: The amount of fuel in the recipe. :param ammo: The amount of ammo in the recipe. :param steel: The amount of steel in the recipe. :param baux: The amount of Bauxite in the recipe. :param ship: The ship object to add to the dock. :return: """ dock.fuel = fuel dock.ammo = ammo dock.steel = steel dock.baux = baux if ship is not None: dock.cmats = 1 try: if build: ntime = util.millisecond_timestamp( datetime.datetime.now() + datetime.timedelta(minutes=ship.ship.buildtime)) else: ntime = util.millisecond_timestamp( datetime.datetime.now() + datetime.timedelta( minutes=ShipHelper.get_repair_time(ship))) except TypeError: ntime = util.millisecond_timestamp(datetime.datetime.now() + datetime.timedelta(minutes=22)) dock.complete = ntime else: dock.cmats = 0 dock.complete = 0 dock.ship = ship return dock
def update_dock(dock: Dock, fuel: int=None, ammo: int=None, steel: int=None, baux: int=None, ship: Kanmusu=None, build=True): dock.resources.fuel = fuel dock.resources.ammo = ammo dock.resources.steel = steel dock.resources.baux = baux if ship is not None: try: if build: ntime = util.millisecond_timestamp( datetime.datetime.now() + datetime.timedelta(minutes=ship.ship.buildtime)) else: ntime = util.millisecond_timestamp( datetime.datetime.now() + datetime.timedelta(minutes=ship.ship.repairtime)) except TypeError: ntime = util.millisecond_timestamp(datetime.datetime.now() + datetime.timedelta(minutes=22)) dock.complete = ntime else: dock.complete = 0 dock.kanmusu = ship return dock
def update_dock(dock: db.Dock, fuel: int, ammo: int, steel: int, baux: int, ship: db.AdmiralShip): dock.fuel = fuel dock.ammo = ammo dock.steel = steel dock.baux = baux dock.cmats = 1 dock.ship = ship try: ntime = util.millisecond_timestamp(datetime.datetime.now() + datetime.timedelta(minutes=ship.ship.buildtime)) except TypeError: ntime = util.millisecond_timestamp(datetime.datetime.now() + datetime.timedelta(minutes=22)) dock.complete = ntime return dock
def new_admiral(): """ Sets up an admiral. This is for both APIv1 and APIv2. :param first_ship_id: The ID of the very first ship. :param admiral: The admiral object to setup. :return: The setup admiral. """ admiral = Admiral() # Give the admiral starting resources admiral.resources = Resource(fuel=500, ammo=500, steel=500, baux=500, flame=1, bucket=1, material=3) # Give the admiral some docks. docks = [Dock() for _ in range(8)] admiral.docks = docks # Return the admiral admiral.setup = False return admiral