diff --git a/app/app.py b/app/app.py index 15994d4..210156a 100644 --- a/app/app.py +++ b/app/app.py @@ -4,14 +4,18 @@ from flask import Flask from flask_cors import CORS from flask_restx import Api, Resource -from app.functions.role_physical_attack import roll_physical_attack +from .functions.roll_dices import roll_dices +from .functions.role_physical_attack import roll_physical_attack +from .functions.roll_mental_attack import roll_mental_attack from .functions.build_character_sheet import build_character_sheet from .functions.roll_ability_scores import roll_ability_scores from .functions.roll_ability_check import roll_ability_check -from .functions.roll_dices import roll_dices from .functions.roll_encounter import roll_encounter -from .functions.roll_mental_attack import roll_mental_attack from .functions.roll_mutations import roll_mutations + +from .tables.physattack import AttackerWeaponClassMatrix, AttackerHitDiceMatrix +from .tables.mentattack import MentalAttackMatrix + from .models.models import dice_model, ability_model, hp_model, character_model, encounter_model, ma_model, \ mutation_model, check_model, pa_model from .schemas.schemas import DiceSchema, CharacterSchema, EncounterSchema, MentalAttackSchema, AbilitySchema, \ @@ -215,5 +219,19 @@ class GenerateCharacter(Resource): return build_character_sheet(chartype), 200 +@api.route('/matrices/dump', methods=['GET']) +class DumpMatrices(Resource): + def get(self): + awc_table = AttackerWeaponClassMatrix().get_matrix().to_json(orient='index') + ahd_table = AttackerHitDiceMatrix().get_matrix().to_json(orient='index') + mat_table = MentalAttackMatrix().get_matrix().to_json(orient='index') + + return { + "Weapon Attack Table": awc_table, + "Non-Weapon Attack Table": ahd_table, + "Mental Attack Table": mat_table + }, 200 + + if __name__ == '__main__': app.run() diff --git a/web/display_tables.html b/web/display_tables.html new file mode 100644 index 0000000..251f89c --- /dev/null +++ b/web/display_tables.html @@ -0,0 +1,98 @@ + + + + Table View + + + + + + +
+ + + + \ No newline at end of file diff --git a/web/index.html b/web/index.html index 9bf33fa..5db7527 100644 --- a/web/index.html +++ b/web/index.html @@ -21,6 +21,7 @@ +
@@ -30,6 +31,10 @@ document.addEventListener('DOMContentLoaded', function () { loadContent("intro.html"); + document.getElementById("tables").addEventListener("click", function () { + loadContent("display_tables.html?t=" + new Date().getTime()); + }); + document.getElementById("dieroller").addEventListener("click", function () { loadContent("rolldice.html?t=" + new Date().getTime()); });