You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

75 lines
2.2 KiB

from flask import (
request,
jsonify,
current_app,
render_template,
send_file,
Blueprint
)
from acks.views import basic_auth
from .quest_manager import (
load_quests,
get_quest_details,
get_quest_archive
)
quest_views = Blueprint(
'quest_manager',
__name__,
template_folder='templates',
url_prefix='/quest'
)
@quest_views.route('/list')
@basic_auth.required
def quest_list():
quests = load_quests()
return render_template('quest_list.html', quest_map=quests)
@quest_views.route('/detail/<int:level>/<string:quest_name>')
@basic_auth.required
def quest_detail(level, quest_name):
quest = get_quest_details(level, quest_name)
return render_template('quest_detail.html', quest=quest)
@quest_views.route('/detail/<int:level>/<string:quest_name>/download')
@basic_auth.required
def quest_download(level, quest_name):
archive = get_quest_archive(level, quest_name)
return send_file(archive, attachment_filename="acks_{0}.zip".format(quest_name), as_attachment=True)
'''
@npc_views.route('/party')
@npc_views.route('/party/<int:base_level>')
def generate_npc_party(base_level=None):
party = None
if base_level:
party = create_party(base_level)
# If asked for JSON, return the party, otherwise render HTML template
if request.args.get('format', 'html') == 'json':
return jsonify([npc.roll20_format for npc in party])
return render_template('generate_npc_party.html', party=party, base_level=base_level)
@npc_views.route('/single')
@npc_views.route('/single/<int:base_level>/<int:guild_id>')
def generate_single_npc(base_level=None, guild_id=0):
guilds = CharacterClass.query.filter(CharacterClass.bucket.notin_(['Demi-Human'])).all()
npc = None
if base_level:
npc = create_npc(base_level, guild_id)
# If asked for JSON, return the npc, otherwise render HTML template
if request.args.get('format', 'html') == 'json':
return jsonify(npc)
return render_template('generate_single_npc.html', npc=npc, base_level=base_level, guilds=guilds, guild_id=guild_id)
@npc_views.route('/spells')
def spell_list():
spells = Spell.query.all()
return render_template('spell_list.html', spells=spells)
'''