Browse Source

Treasure generator, new heading style for all pages

master
Brandon Cornejo 4 years ago
parent
commit
d00d53f304
  1. 7
      acks/npc/templates/generate_npc_party.html
  2. 7
      acks/npc/templates/generate_single_npc.html
  3. 7
      acks/npc/templates/spell_list.html
  4. 42
      acks/templates/base.html
  5. 8
      acks/templates/handbook.html
  6. 8
      acks/templates/index.html
  7. 68
      acks/templates/treasure.html
  8. 8
      acks/templates/worldmap.html
  9. 16
      acks/views.py

7
acks/npc/templates/generate_npc_party.html

@ -4,7 +4,7 @@
{% block title %}NPC Party Generation{% endblock %}
{% block content %}
<div class="uk-flex uk-flex-center uk-margin-bottom uk-margin-top">
<h1>Adventurer Conqueror King NPC Party Generator</h1>
<h1 class="uk-text-center"><strong>Adventurer Conqueror King</strong>NPC Party Generator</h1>
</div>
<div class="uk-flex uk-flex-bottom uk-flex-center uk-margin-large-bottom">
<div>
@ -238,6 +238,11 @@ div.save-block > div > div:last-child {
div.acks-npc-card {
width: 400px;
}
h1 strong {
display: block;
font-size: 50%;
opacity: 0.65;
}
</style>
<script type="text/javascript">
var party = [];

7
acks/npc/templates/generate_single_npc.html

@ -4,7 +4,7 @@
{% block title %}Single NPC Generation{% endblock %}
{% block content %}
<div class="uk-flex uk-flex-center uk-margin-bottom uk-margin-top">
<h1>Adventurer Conqueror King NPC Generator</h1>
<h1 class="uk-text-center"><strong>Adventurer Conqueror King</strong>NPC Generator</h1>
</div>
<div class="uk-flex uk-flex-bottom uk-flex-center uk-margin-large-bottom">
<div>
@ -241,6 +241,11 @@ div.save-block > div > div:last-child {
div.acks-npc-card {
width: 400px;
}
h1 strong {
display: block;
font-size: 50%;
opacity: 0.65;
}
</style>
<script type="text/javascript">
var party = [];

7
acks/npc/templates/spell_list.html

@ -4,7 +4,7 @@
{% block title %}Spell List{% endblock %}
{% block content %}
<div class="uk-flex uk-flex-center uk-margin-bottom uk-margin-top">
<h1>Adventurer Conqueror King Spell List</h1>
<h1 class="uk-text-center"><strong>Adventurer Conqueror King</strong>Spell Reference</h1>
</div>
<div class="uk-flex uk-flex-bottom uk-flex-center uk-margin-small-bottom">
<div>
@ -146,5 +146,10 @@ div.save-block > div > div:last-child {
div.acks-npc-card {
width: 400px;
}
h1 strong {
display: block;
font-size: 50%;
opacity: 0.65;
}
</style>
{% endblock %}

42
acks/templates/base.html

@ -1,18 +1,22 @@
{% set navigation_bar = [
('/', 'index', 'Home'),
('/handbook', 'handbook', 'Handbook'),
('/npc/party', 'npcparty', 'NPC Party'),
('/npc/single', 'npcsingle', 'Single NPC'),
('/worldmap', 'worldmap', 'World Map'),
('', 'generate', 'Generate'),
('/npc/spells', 'spells', 'Spells'),
('/api/schema', 'api', 'API'),
('/worldmap', 'worldmap', 'World Map'),
] %}
{% set generation_bar = [
('/npc/party', 'npcparty', 'NPC Party'),
('/npc/single', 'npcsingle', 'Single NPC'),
('/treasure', 'treasure', 'Treasure'),
] %}
{% set active_page = active_page|default('index') %}
<!doctype html>
<html>
<head>
<title>{% block title %}{% endblock %} - Atr0phy ACKS</title>
<title>{% block title %}{% endblock %} - Palisma ACKS</title>
<meta charset="utf-8">
<meta name="viewport" contents="width=device-width, initial-scale=1">
@ -32,13 +36,24 @@
<nav class="uk-navbar-container" uk-navbar>
<div class="uk-navbar-left">
<a href="" class="uk-hidden@m uk-button-default uk-margin-small-left uk-margin-small-right" uk-toggle="target: #offcanvas-nav" uk-icon="menu"></a>
<a href="" class="uk-navbar-item uk-logo">Atr0phy ACKS</a>
<a href="" class="uk-navbar-item uk-logo">Palisma ACKS</a>
</div>
<div class="uk-navbar-center uk-visible@m">
<ul class="uk-navbar-nav">
{% for href, id, label in navigation_bar %}
<li {% if id == active_page %} class="uk-active" {% endif %}>
{% if id == 'generate' %}
<a href="">{{ label |e }}</a>
<div class="uk-navbar-dropdown">
<ul class="uk-nav uk-navbar-dropdown-nav">
{% for ghref, gid, glabel in generation_bar %}
<li><a href="{{ ghref | e }}">{{ glabel|e }}</a></li>
{% endfor %}
</ul>
</div>
{% else %}
<a href="{{ href|e }}">{{ label|e }}</a>
{% endif %}
</li>
{% endfor %}
</ul>
@ -48,9 +63,20 @@
<div class="uk-offcanvas-bar uk-flex uk-flex-column">
<ul class="uk-nav uk-nav-primary uk-nav-center uk-margin-auto-vertical">
{% for href, id, label in navigation_bar %}
<li {% if id == active_page %} class="uk-active" {% endif %}>
<a href="{{ href|e }}">{{ label|e }}</a>
</li>
<li {% if id == active_page %} class="uk-active" {% endif %}>
{% if id == 'generate' %}
<a href="">{{ label |e }}</a>
<div class="uk-navbar-dropdown">
<ul class="uk-nav uk-navbar-dropdown-nav">
{% for ghref, gid, glabel in generation_bar %}
<li><a href="{{ ghref | e }}">{{ glabel|e }}</a></li>
{% endfor %}
</ul>
</div>
{% else %}
<a href="{{ href|e }}">{{ label|e }}</a>
{% endif %}
</li>
{% endfor %}
</ul>
</div>

8
acks/templates/handbook.html

@ -3,6 +3,9 @@
{% block title %}ACKS Handbook{% endblock %}
{% block content %}
<div class="uk-flex uk-flex-center uk-margin-bottom uk-margin-top">
<h1 class="uk-text-center"><strong>Adventurer Conqueror King</strong>Handbook</h1>
</div>
<div id="frame-container">
<iframe id="handbook-frame" src="https://atr0phy.net/acks/handbook"/>
</div>
@ -22,5 +25,10 @@
margin: 0;
padding: 0;
}
h1 strong {
display: block;
font-size: 50%;
opacity: 0.65;
}
</style>
{% endblock %}

8
acks/templates/index.html

@ -3,11 +3,17 @@
{% block title %}ACKS Toolset Home{% endblock %}
{% block content %}
<div>
<div class="uk-flex uk-flex-center uk-margin-bottom uk-margin-top">
<h1 class="uk-text-center"><strong>Adventurer Conqueror King</strong>Home</h1>
</div>
{% endblock %}
{% block head %}
<style>
h1 strong {
display: block;
font-size: 50%;
opacity: 0.65;
}
</style>
{% endblock %}

68
acks/templates/treasure.html

@ -0,0 +1,68 @@
{% extends "base.html" %}
{% set active_page = "handbook" %}
{% set treasure_letters = [
("A", "Incidental 275gp"),
("B", "Hoarder 500gp"),
("C", "Incidental 700gp"),
("D", "Hoarder 1,000gp"),
("E", "Raider 1,250gp"),
("F", "Incidental 1,500gp"),
("G", "Raider 2,000gp"),
("H", "Hoarder 2,500gp"),
("I", "Incidental 3,250gp"),
("J", "Raider 4,000gp"),
("K", "Incidental 5,000gp"),
("L", "Raider 6,000gp"),
("M", "Incidental 8,000gp"),
("N", "Hoarder 9,000gp"),
("O", "Raider 12,000gp"),
("P", "Incidental 17,000gp"),
("Q", "Hoarder 22,000gp"),
("R", "Hoarder 45,000gp"),
] %}
{% block title %}ACKS Treasure Generator{% endblock %}
{% block content %}
<div class="uk-flex uk-flex-center uk-margin-bottom uk-margin-top">
<h1 class="uk-text-center"><strong>Adventurer Conqueror King</strong>Treasure Generator</h1>
</div>
<div class="uk-flex uk-flex-bottom uk-flex-center uk-margin-large-bottom">
<div>
<label for="treasure-type" class="uk-form-label">Select Treasure Type</label>
<select id="treasure-type" class="uk-select">
<option value="">Please select one</option>
{% for v, l in treasure_letters %}
<option value="{{ v }}" {% if treasure_type == v %} selected="true" {% endif %}>{{ v }} ({{ l }})</option>
{% endfor %}
</select>
</div>
<div class="uk-margin-left">
<button class="uk-button uk-button-primary" onclick="generateTreasure();">Generate</button>
</div>
</div>
{% if generated_treasure %}
<div class="uk-flex uk-flex-bottom uk-flex-center uk-margin-large-bottom">
<div id="treasure-content">
{{ generated_treasure|safe }}
</div>
</div>
{% endif %}
{% endblock %}
{% block head %}
<style>
h1 strong {
display: block;
font-size: 50%;
opacity: 0.65;
}
</style>
<script>
function generateTreasure() {
var treasure_type = document.querySelector("select#treasure-type").value;
window.location = "/treasure/" + treasure_type.toString();
}
</script>
{% endblock %}

8
acks/templates/worldmap.html

@ -3,6 +3,9 @@
{% block title %}World Map{% endblock %}
{% block content %}
<div class="uk-flex uk-flex-center uk-margin-bottom uk-margin-top">
<h1 class="uk-text-center"><strong>Adventurer Conqueror King</strong>World Map</h1>
</div>
<br/>
<div>
<img id="worldmap-img" src="https://acks.atr0phy.net/static/WorldMap.png"/>
@ -11,5 +14,10 @@
{% block head %}
<style>
h1 strong {
display: block;
font-size: 50%;
opacity: 0.65;
}
</style>
{% endblock %}

16
acks/views.py

@ -1,3 +1,4 @@
import requests
from flask import current_app, Blueprint, render_template, url_for, redirect
@ -15,3 +16,18 @@ def handbook():
@default_views.route('/worldmap')
def worldmap():
return render_template('worldmap.html')
@default_views.route('/treasure')
@default_views.route('/treasure/<string:treasure_type>')
def treasure(treasure_type=None):
if treasure_type is not None:
headers = {'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'}
payload = {
"treasure_type": treasure_type,
"form_id": "acks_treasure_form",
"form_build_id": "form-PqO-1VglfW4Q3x1fm7HMewhLFjst2oxY5AR_m6WOGBg"
}
response = requests.request("POST", "http://autarch.co/system/ajax", data=payload, headers=headers)
generated_treasure = response.json()[1]["data"].replace('class="form-textarea"', 'class="uk-textarea"')
return render_template('treasure.html', generated_treasure=generated_treasure, treasure_type=treasure_type)
return render_template('treasure.html')
Loading…
Cancel
Save