Brandon Cornejo
5 years ago
3 changed files with 31 additions and 79 deletions
@ -0,0 +1,4 @@ |
|||
# OrnaRPG Tools |
|||
|
|||
Equipment combination toolkit |
|||
https://orna.atr0phy.net |
@ -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] |
|||
] |
|||
""" |
Write
Preview
Loading…
Cancel
Save
Reference in new issue