def firstship(): admiral = get_token_admiral_or_error() if admiral.setup: return svdata({'api_result_msg': "Nice try.", 'api_result': 200}) shipid = request.values.get("api_ship_id") ShipHelper.assign_ship(admiral, shipid) admiral.setup = True db.session.add(admiral) db.session.commit() return svdata({'api_result_msg': 'shitty api is shitty', 'api_result': 1})
def ship_add(admiral_id,ship_id): """ This is going to crash the game after 4 uses because tThe method adds a new fleet every time it's called. I could fix it, be we'll refactor most of this really soon, so I can't be bothered. """ admiral = db.session.query(Admiral).get(admiral_id) ship = db.session.query(Ship).get(ship_id) if ship is not None: ShipHelper.assign_ship(admiral,ship_id) db.session.commit() print("Ship {} added to Admiral {}".format(ship.name,admiral.id)) else: print("Ship id {} not found".format(ship_id))
def ship_add(admiral_id, ship_id): """ This is going to crash the game after 4 uses because tThe method adds a new fleet every time it's called. I could fix it, be we'll refactor most of this really soon, so I can't be bothered. """ admiral = db.session.query(Admiral).get(admiral_id) ship = db.session.query(Ship).get(ship_id) if ship is not None: ShipHelper.assign_ship(admiral, ship_id) db.session.commit() print("Ship {} added to Admiral {}".format(ship.name, admiral.id)) else: print("Ship id {} not found".format(ship_id))