From bf9598eb8fc9df0edf56d5361e4cec4cf14011b8 Mon Sep 17 00:00:00 2001
From: James <9213561+Gensokian@users.noreply.github.com>
Date: Mon, 26 Sep 2022 15:28:28 +0200
Subject: [PATCH] added switch state
---
index.php | 44 ++++++++++++++++++++++++++++++--------------
1 file changed, 30 insertions(+), 14 deletions(-)
diff --git a/index.php b/index.php
index 4d9d99f..6c8c6ef 100644
--- a/index.php
+++ b/index.php
@@ -205,8 +205,8 @@
Health kind
Are we using Max, Average or rolled HP?
-
-
+
+
@@ -987,7 +987,8 @@
}
function usingHPDice(e) {
- if (e) {
+ switch (e) {
+ case "dice":
$("#HP_max_card").hide("fast");
$("#HP_average_card").hide("fast");
$("#HP_hitdice_card").show("fast");
@@ -996,8 +997,8 @@
$("#mob_hp_dice_ammount").val("");
$("#mob_hp_dice_type").val("");
$("#mob_hp_max").val("");
-
- } else if (e == false) {
+ break;
+ case "averages":
$("#HP_max_card").hide("fast");
$("#HP_hitdice_card").hide("fast");
$("#HP_average_card").show("fast");
@@ -1007,17 +1008,32 @@
$("#mob_hp_dice_type").val("");
$("#mob_hp_max").val("");
- } else if (e == "max") {
+ break;
+ case "averages":
+ $("#HP_max_card").hide("fast");
+ $("#HP_hitdice_card").hide("fast");
+ $("#HP_average_card").show("fast");
- $("#HP_max_card").show("fast");
- $("#HP_hitdice_card").hide("fast");
- $("#HP_average_card").hide("fast");
+ $("#mob_hp_avg").val("");
+ $("#mob_hp_dice_ammount").val("");
+ $("#mob_hp_dice_type").val("");
+ $("#mob_hp_max").val("");
- $("#mob_hp_avg").val("");
- $("#mob_hp_dice_ammount").val("");
- $("#mob_hp_dice_type").val("");
- $("#mob_hp_max").val("");
- }
+ break;
+ case "max":
+
+
+ $("#HP_max_card").show("fast");
+ $("#HP_hitdice_card").hide("fast");
+ $("#HP_average_card").hide("fast");
+
+ $("#mob_hp_avg").val("");
+ $("#mob_hp_dice_ammount").val("");
+ $("#mob_hp_dice_type").val("");
+ $("#mob_hp_max").val("");
+ break;
+
+ }
calcDiff();
}