diff --git a/README.md b/README.md new file mode 100644 index 0000000..c1eabdd --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# OrnaRPG Tools + +Equipment combination toolkit +https://orna.atr0phy.net diff --git a/orna-tools.py b/orna-tools.py deleted file mode 100644 index 97e1ace..0000000 --- a/orna-tools.py +++ /dev/null @@ -1,70 +0,0 @@ -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/templates/index.html b/templates/index.html index 40e486f..00bf41c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -24,13 +24,13 @@
-
Use the three tabs to input your options for each equipment slot (head/chest/leg). Click the calculate button to populate a table with possible combinations. Click on the column headers to sort results. Use the green + to input additional items.
+
Use the three tabs to input your options for each equipment slot (head/chest/leg). Click the calculate button to populate a table with possible combinations. Click on the column headers to sort results.

Ctrl+Enter adds a new row to existing table, or use the green + to input additional items.