def network_invite_deny(network_id): """Player denies an invite to join a network.""" player = get_player() try: player.deny_network(network_id) flash(u"You have successfully denied an invitation to join a network.", "notice") except ALL_EXCEPTIONS as e: flash_e(e, "warning") return redirect(url_for("game.network"))
def research(): """Renders the main research page.""" player = get_player() #Get only researches and their status all_buildings = [] for building in GAME_BUILDINGS: if building.building_type == 1: status = (player.can_build(building), player.is_built(building), player.is_building(building)) all_buildings.append( (building, status) ) return render_template("game/researches/index.html", all_buildings=all_buildings, player=player)
def start_building(dep_pos): """Starts building specified building (based on dependency position).""" player = get_player() #Check if a user can build this building building = [building for building in GAME_BUILDINGS if building.dep_pos == dep_pos][0] if player.can_build(building): #TODO: No instant building allowed player.DEBUG_instant_build(building) flash(u"Building built", "notice") else: flash(u"You can't build this building", "warning") return redirect(url_for("game.building"))