added check if skills are included

This commit is contained in:
Patryk Hegenberg 2023-12-15 08:22:34 +01:00
parent aba6e13663
commit f84ee2a466
2 changed files with 110 additions and 36 deletions

View file

@ -64,6 +64,80 @@ func parseInt(s string) int {
// parseMonster parses the Monster from monsterForm.html and return it.
func parseMonster(r *http.Request) model.Monster {
var (
acrobatics = ""
animalHandling = ""
arcana = ""
athletics = ""
deception = ""
history = ""
insight = ""
intimidation = ""
investigation = ""
medicine = ""
nature = ""
performance = ""
perception = ""
persuasion = ""
sleightOfHand = ""
religion = ""
stealth = ""
survival = ""
)
if r.FormValue("checkAcrobatics") == "on" {
acrobatics = r.FormValue("acrobatics")
}
if r.FormValue("checkAnimalHandling") == "on" {
animalHandling = r.FormValue("animalHandling")
}
if r.FormValue("checkArcana") == "on" {
arcana = r.FormValue("arcana")
}
if r.FormValue("checkAthletics") == "on" {
athletics = r.FormValue("athletics")
}
if r.FormValue("checkDeception") == "on" {
deception = r.FormValue("deception")
}
if r.FormValue("checkHistory") == "on" {
history = r.FormValue("history")
}
if r.FormValue("checkInsight") == "on" {
insight = r.FormValue("insight")
}
if r.FormValue("checkIntimidation") == "on" {
intimidation = r.FormValue("intimidation")
}
if r.FormValue("checkInvestigation") == "on" {
investigation = r.FormValue("investigation")
}
if r.FormValue("checkMedicine") == "on" {
medicine = r.FormValue("medicine")
}
if r.FormValue("checkNature") == "on" {
nature = r.FormValue("nature")
}
if r.FormValue("checkPerformance") == "on" {
performance = r.FormValue("performance")
}
if r.FormValue("checkPerception") == "on" {
perception = r.FormValue("perception")
}
if r.FormValue("checkPersuasion") == "on" {
persuasion = r.FormValue("persuasion")
}
if r.FormValue("checkSleightOfHand") == "on" {
sleightOfHand = r.FormValue("sleightOfHand")
}
if r.FormValue("checkStealth") == "on" {
stealth = r.FormValue("stealth")
}
if r.FormValue("checkSurvival") == "on" {
survival = r.FormValue("survival")
}
if r.FormValue("checkReligion") == "on" {
religion = r.FormValue("religion")
}
return model.Monster{
Name: r.FormValue("name"),
Source: r.FormValue("source"),
@ -102,24 +176,24 @@ func parseMonster(r *http.Request) model.Monster {
Int: r.FormValue("saveInt"),
},
Skill: model.Skill{
Perception: r.FormValue("perception"),
Stealth: r.FormValue("stealth"),
Acrobatics: r.FormValue("acrobatics"),
AnimalHandling: r.FormValue("animalHandling"),
Arcana: r.FormValue("arcana"),
Athletics: r.FormValue("athletics"),
Deception: r.FormValue("deception"),
History: r.FormValue("history"),
Insight: r.FormValue("insight"),
Intimidation: r.FormValue("intimidation"),
Investigation: r.FormValue("investigation"),
Medicine: r.FormValue("medicine"),
Nature: r.FormValue("nature"),
Performance: r.FormValue("performance"),
Persuasion: r.FormValue("persuasion"),
SleightOfHand: r.FormValue("sleightOfHand"),
Survival: r.FormValue("survival"),
Religion: r.FormValue("religion"),
Perception: perception,
Stealth: stealth,
Acrobatics: acrobatics,
AnimalHandling: animalHandling,
Arcana: arcana,
Athletics: athletics,
Deception: deception,
History: history,
Insight: insight,
Intimidation: intimidation,
Investigation: investigation,
Medicine: medicine,
Nature: nature,
Performance: performance,
Persuasion: persuasion,
SleightOfHand: sleightOfHand,
Survival: survival,
Religion: religion,
},
Resist: []string{r.FormValue("resist")},
ConditionImmune: []string{r.FormValue("conditionImmune")},

View file

@ -76,7 +76,7 @@
<div class="tile is-ancestor">
<div class="tile is-parent">
<div class="tile is-child field">
<label class="checkbox" for="acrobatics"><input type="checkbox">Acrobatics:</label>
<label class="checkbox" for="acrobatics"><input type="checkbox" name="checkAcrobatics">Acrobatics:</label>
<div class="control">
<input type="text" name="acrobatics" required class="input input-bordered w-full max-w-xs" value="{{
.acrobatics }}" readonly>
@ -85,7 +85,7 @@
</div>
<div class="tile is-parent">
<div class="tile is-child field">
<label for="animalHandling" class="checkbox"><input type="checkbox">Animal Handling:</label>
<label for="animalHandling" class="checkbox"><input type="checkbox" name="checkAnimalHandling">Animal Handling:</label>
<div class="control">
<input type="text" name="animalHandling" required class="input input-bordered w-full max-w-xs"
value="{{ .animalHandling }}" readonly>
@ -94,7 +94,7 @@
</div>
<div class="tile is-parent">
<div class="tile is-child field">
<label for="arcana" class="ceckbox"><input type="checkbox">Arcana:</label>
<label for="arcana" class="ceckbox"><input type="checkbox" name="checkArcana">Arcana:</label>
<div class="control">
<input type="text" name="arcana" required class="input input-bordered w-full max-w-xs" value="{{ .arcana }}"
readonly>
@ -105,7 +105,7 @@
<div class="tile is-ancestor">
<div class="tile is-parent">
<div class="tile is-child field">
<label for="athletics" class="checkbox"><input type="checkbox">Athletics:</label>
<label for="athletics" class="checkbox"><input type="checkbox" name="checkAthletics">Athletics:</label>
<div class="control">
<input type="text" name="athletics" required class="input input-bordered w-full max-w-xs"
value="{{ .athletics }}" readonly>
@ -114,7 +114,7 @@
</div>
<div class="tile is-parent">
<div class="tile is-child field">
<label for="deception" class="checkbox"><input type="checkbox">Deception:</label>
<label for="deception" class="checkbox"><input type="checkbox" name="checkDeception">Deception:</label>
<div class="control">
<input type="text" name="deception" required class="input input-bordered w-full max-w-xs"
value="{{ .deception }}" readonly>
@ -123,7 +123,7 @@
</div>
<div class="tile is-parent">
<div class="tile is-child field">
<label for="history" class="checkbox"><input type="checkbox">History:</label>
<label for="history" class="checkbox"><input type="checkbox" name="checkHistory">History:</label>
<div class="control">
<input type="text" name="history" required class="input input-bordered w-full max-w-xs"
value="{{ .history }}" readonly>
@ -134,7 +134,7 @@
<div class="tile is-ancestor">
<div class="tile is-parent">
<div class="tile is-child field">
<label for="insight" class="checkbox"><input type="checkbox">Insight:</label>
<label for="insight" class="checkbox"><input type="checkbox" name="checkInsight">Insight:</label>
<div class="control">
<input type="text" name="insight" required class="input input-bordered w-full max-w-xs"
value="{{ .insight }}" readonly>
@ -143,7 +143,7 @@
</div>
<div class="tile is-parent">
<div class="tile is-child field">
<label for="intimidation" class="checkbox"><input type="checkbox">Intimidation:</label>
<label for="intimidation" class="checkbox"><input type="checkbox" name="checkIntimidation">Intimidation:</label>
<div class="control">
<input type="text" name="intimidation" required class="input input-bordered w-full max-w-xs"
value="{{ .intimidation }}" readonly>
@ -152,7 +152,7 @@
</div>
<div class="tile is-parent">
<div class="tile is-child field">
<label for="investigation" class="checkbox"><input type="checkbox">Investigation:</label>
<label for="investigation" class="checkbox"><input type="checkbox" name="checkInvestigation">Investigation:</label>
<div class="control">
<input type="text" name="investigation" required class="input input-bordered w-full max-w-xs"
value="{{ .investigation }}" readonly>
@ -163,7 +163,7 @@
<div class="tile is-ancestor">
<div class="tile is-parent">
<div class="tile is-child field">
<label for="medicine" class="checkbox"><input type="checkbox">Medicine:</label>
<label for="medicine" class="checkbox"><input type="checkbox" name="checkMedicine">Medicine:</label>
<div class="control">
<input type="text" name="medicine" required class="input input-bordered w-full max-w-xs"
value="{{ .medicine }}" readonly>
@ -172,7 +172,7 @@
</div>
<div class="tile is-parent">
<div class="tile is-child field">
<label for="nature" class="checkbox"><input type="checkbox">Nature:</label>
<label for="nature" class="checkbox"><input type="checkbox" name="checkNature">Nature:</label>
<div class="control">
<input type="text" name="nature" required class="input input-bordered w-full max-w-xs" value="{{ .nature }}"
readonly>
@ -181,7 +181,7 @@
</div>
<div class="tile is-parent">
<div class="tile is-child field">
<label for="performance" class="checkbox"><input type="checkbox">Performance:</label>
<label for="performance" class="checkbox"><input type="checkbox" name="checkPerformance">Performance:</label>
<div class="control">
<input type="text" name="performance" required class="input input-bordered w-full max-w-xs"
value="{{ .performance }}" readonly>
@ -192,7 +192,7 @@
<div class="tile is-ancestor">
<div class="tile is-parent">
<div class="tile is-child field">
<label for="perception" class="checkbox"><input type="checkbox">Perception:</label>
<label for="perception" class="checkbox"><input type="checkbox" name="checkPerception">Perception:</label>
<div class="control">
<input type="text" name="perception" required class="input input-bordered w-full max-w-xs"
value="{{ .perception }}" readonly>
@ -201,7 +201,7 @@
</div>
<div class="tile is-parent">
<div class="tile is-child field">
<label for="stealth" class="checkbox"><input type="checkbox">Stealth:</label>
<label for="stealth" class="checkbox"><input type="checkbox" name="checkStealth">Stealth:</label>
<div class="control">
<input type="text" name="stealth" required class="input input-bordered w-full max-w-xs"
value="{{ .stealth }}" readonly>
@ -210,7 +210,7 @@
</div>
<div class="tile is-parent">
<div class="tile is-child field">
<label for="persuasion" class="checkbox"><input type="checkbox">Persuasion:</label>
<label for="persuasion" class="checkbox"><input type="checkbox" name="checkPersuasion">Persuasion:</label>
<div class="control">
<input type="text" name="persuasion" required class="input input-bordered w-full max-w-xs"
value="{{ .persuasion }}" readonly>
@ -221,7 +221,7 @@
<div class="tile is-ancestor">
<div class="tile is-parent">
<div class="tile is-child field">
<label for="sleightOfHand" class="checkbox"><input type="checkbox">Sleight of Hand:</label>
<label for="sleightOfHand" class="checkbox"><input type="checkbox" name="checkSleightOfHand">Sleight of Hand:</label>
<div class="control">
<input type="text" name="sleightOfHand" required class="input input-bordered w-full max-w-xs"
value="{{.sleightOfHand }}" readonly>
@ -230,7 +230,7 @@
</div>
<div class="tile is-parent">
<div class="tile is-child field">
<label for="religion" class="checkbox"><input type="checkbox">Religion:</label>
<label for="religion" class="checkbox"><input type="checkbox" name="checkReligion">Religion:</label>
<div class="control">
<input type="text" name="religion" required class="input input-bordered w-full max-w-xs"
value="{{ .religion }}" readonly>
@ -239,7 +239,7 @@
</div>
<div class="tile is-parent">
<div class="tile is-child field">
<label for="survival" class="checkbox"><input type="checkbox">Survival:</label>
<label for="survival" class="checkbox"><input type="checkbox" name="checkSurvival">Survival:</label>
<div class="control">
<input type="text" name="survival" required class="input input-bordered w-full max-w-xs"
value="{{ .survival }}" readonly>