From b9ef801f777e46b6e96ee63e9a42d68e7a5ffba9 Mon Sep 17 00:00:00 2001 From: Brandon Cornejo Date: Sun, 2 Feb 2020 12:19:01 -0600 Subject: [PATCH] Initial commit --- orna-tools.py | 70 ++++++++++++ requirements.txt | 7 ++ templates/index.html | 261 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 338 insertions(+) create mode 100644 orna-tools.py create mode 100644 requirements.txt create mode 100644 templates/index.html diff --git a/orna-tools.py b/orna-tools.py new file mode 100644 index 0000000..97e1ace --- /dev/null +++ b/orna-tools.py @@ -0,0 +1,70 @@ +from flask import Flask, render_template, jsonify, request + +app = Flask(__name__) + +@app.route('/') +def index(): + return render_template('index.html') + +@app.route('/results', methods=['POST']) +def results(): + combinations = calculate_combinations(request.get_json()) + return jsonify(combinations) + + +# Data Methods +def calculate_combinations(equipment, do_print=True): + # name, defense, resistance + eq_headware = equipment["head"] + eq_chestware = equipment["chest"] + eq_legwear = equipment["legs"] + + # Create a list of all possible eq combinations + results = [] + for hw in eq_headware: + print('Headware: {}'.format(hw)) + for cw in eq_chestware: + print('Chestware: {}'.format(cw)) + for lw in eq_legwear: + print('legware: {}'.format(lw)) + result = {} + result["eq"] = [hw[0], cw[0], lw[0]] + result["def"] = hw[1] + cw[1] + lw[1] + result["res"] = hw[2] + cw[2] + lw[2] + results.append(result) + + # Sort the combinations by combined total of def anf res + results.sort(key=lambda i: i["def"] + i["res"]) + + if do_print: + for result in results: + print("{} ({} def {} res) -".format(result["def"] + result["res"], result["def"], result["res"])) + for eq in result["eq"]: + print("\t{}".format(eq)) + + return results + + +""" +eq_headware = [ + ["Ljosalfar Hood", 98, 510], + ["Kobold Hood", 0, 614], + ["Northern Cowl", 584, 130], + ["High Fomorian Hood", 487, 112] +] + +eq_chestware = [ + ["Ljosalfar Robe", 121, 528], + ["High Fomorian Garb", 544, 0], + ["Darkest Garb", 514, 169], + ["Northern Garb", 535, 119], + ["Northern Robe", 486, 108] +] + +eq_legwear = [ + ["Northern Boots", 636, 142], + ["Terra Boots", 129, 369], + ["High Fomorian Boots", 516, 0], + ["Ljosalfar Boots", 280, 280] +] +""" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..2832e53 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,7 @@ +Click==7.0 +Flask==1.1.1 +itsdangerous==1.1.0 +Jinja2==2.11.1 +MarkupSafe==1.1.1 +pkg-resources==0.0.0 +Werkzeug==0.16.1 diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..1080b80 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,261 @@ + + + + Orna Tools - atr0phy.net + + + + + + + + + + + + + + + + +
+
+ +
    + {% for slot in ["Head", "Chest", "Leg"] %} +
  • +
    + + + + + + + + + + + + + + + + + + + + +
    {{ slot }} Gear
    Item NameDefenseResistance
    1
    +
    + +
    +
    +
  • + {% endfor %} +
+
+
+ +
+ +
+
+ + + + + + + + + + +
TotalDefenseResistanceHeadChestLegs
+
+
+ + + +