Feats feature

This commit is contained in:
Nox Sluijtman 2022-12-31 00:21:29 +01:00
parent 01252f30c3
commit 0d6ad6267e
4 changed files with 40 additions and 16 deletions

View file

@ -36,5 +36,8 @@
{"skillName":"intimidation", "proficient":false, "expertise":true, "baseStat":"charisma"}, {"skillName":"intimidation", "proficient":false, "expertise":true, "baseStat":"charisma"},
{"skillName":"performance", "proficient":true, "expertise":false, "baseStat":"charisma"}, {"skillName":"performance", "proficient":true, "expertise":false, "baseStat":"charisma"},
{"skillName":"persuasion", "proficient":false, "expertise":false, "baseStat":"charisma"} {"skillName":"persuasion", "proficient":false, "expertise":false, "baseStat":"charisma"}
],
"feats":[
{"featName":"Boring", "featDescription":"Due to being excessivly generic, Bob gains... something"}
] ]
} }

26
main.go
View file

@ -16,13 +16,13 @@ import (
const exampleFile string = "/etc/sheet-parser/example.json" const exampleFile string = "/etc/sheet-parser/example.json"
var ( var (
path, pathFlag, skillString, saveString, statString string path, pathFlag, skillString, saveString, statString string
modifier, diceThrows, surfaces int modifier, diceThrows, surfaces int
X, Y int X, Y int
char Character char Character
skillMap = make(map[string]int) skillMap = make(map[string]int)
statMap = make(map[string]int) statMap = make(map[string]int)
advantage, disadvantage, stat_list, skill_list, verbose, trivia bool advantage, disadvantage, stat_list, skill_list, verbose, trivia, feats bool
) )
func parseFlags() { func parseFlags() {
@ -43,6 +43,8 @@ func parseFlags() {
flag.BoolVar(&trivia, "t", false, "Print character name, level and proficiency") flag.BoolVar(&trivia, "t", false, "Print character name, level and proficiency")
flag.BoolVar(&trivia, "trivia", false, "Print character name, level and proficiency") flag.BoolVar(&trivia, "trivia", false, "Print character name, level and proficiency")
flag.BoolVar(&feats, "feats", false, "Print character feats")
flag.Parse() flag.Parse()
} }
@ -109,6 +111,9 @@ func main() {
} }
fmt.Printf("Passive perception: %d\n", passivePerception) fmt.Printf("Passive perception: %d\n", passivePerception)
case feats:
listFeats()
case stat_list && skill_list: case stat_list && skill_list:
printStatList(verbose) printStatList(verbose)
printSkillList(verbose) printSkillList(verbose)
@ -353,3 +358,10 @@ func printSkillList(verbose bool) {
} }
} }
} }
func listFeats() {
color.Magenta("Listing feats...")
for i := 0; i < len(char.Feats); i++ {
fmt.Printf("%25s\t%s\n", char.Feats[i].FeatName, char.Feats[i].FeatDescription)
}
}

View file

@ -4,6 +4,7 @@ type Character struct {
Misc Misc `json:"misc"` Misc Misc `json:"misc"`
Stats []Stat `json:"stats"` Stats []Stat `json:"stats"`
Skills []Skill `json:"skills"` Skills []Skill `json:"skills"`
Feats []Feat `json:"feats"`
} }
type Misc struct { type Misc struct {
@ -16,14 +17,21 @@ type Misc struct {
JackOfAllTrades bool `json:"jackOfAllTrades"` JackOfAllTrades bool `json:"jackOfAllTrades"`
IsKurthog bool `json:"isKurthog"` IsKurthog bool `json:"isKurthog"`
} }
type Skill struct { type Skill struct {
SkillName string `json:"skillName"` SkillName string `json:"skillName"`
Proficient bool `json:"proficient"` Proficient bool `json:"proficient"`
Expertise bool `json:"expertise"` Expertise bool `json:"expertise"`
BaseStat string `json:"baseStat"` BaseStat string `json:"baseStat"`
} }
type Stat struct { type Stat struct {
StatName string `json:"statName"` StatName string `json:"statName"`
Score int `json:"score"` Score int `json:"score"`
Proficient bool `json:"proficient"` Proficient bool `json:"proficient"`
} }
type Feat struct {
FeatName string `json:"featName"`
FeatDescription string `json:"featDescription"`
}

View file

@ -1,18 +1,19 @@
#compdef sheet-parser #compdef sheet-parser
arguments=( arguments=(
'(--advantage --disadvantage --skill --save --stat --skill-list --stat-list -v --verbose --trivia -t)--trivia[Print character trivia]' '(--advantage --disadvantage --skill --save --stat --skill-list --stat-list -v --verbose --trivia -t)--feats[Print charater feats]'
'(--advantage --disadvantage --skill --save --stat --skill-list --stat-list -v --verbose --trivia -t)-t[Print character trivia]' '(--advantage --disadvantage --skill --save --stat --skill-list --stat-list -v --verbose --trivia -t --feats)--trivia[Print character trivia]'
'(--advantage --disadvantage --skill --save --stat --skill-list --stat-list -v --verbose --trivia -t --feats)-t[Print character trivia]'
'(--file)-f=[Path to character sheet]:character sheet:_files -g "*.(json)(-.)"' '(--file)-f=[Path to character sheet]:character sheet:_files -g "*.(json)(-.)"'
'(-f)--file=[Path to character sheet]:character sheet:_files -g "*.(json)(-.)"' '(-f)--file=[Path to character sheet]:character sheet:_files -g "*.(json)(-.)"'
'(--trivia -t --advantage --disadvantage --skill-list --stat-list --skill --save --stat --verbose)-v[To be used in conjuction with list parameters]' '(--trivia -t --advantage --disadvantage --skill-list --stat-list --skill --save --stat --verbose --feats)-v[To be used in conjuction with list parameters]'
'(--trivia -t --advantage --disadvantage --skill-list --stat-list --skill --save --stat -v)--verbose[To be used in conjuction with list parameters]' '(--trivia -t --advantage --disadvantage --skill-list --stat-list --skill --save --stat -v --feats)--verbose[To be used in conjuction with list parameters]'
'(--skill --stat --save --advantage --disadvantage --skill-list --stat-list)--stat-list[List stats found in file]' '(--skill --stat --save --advantage --disadvantage --skill-list --stat-list --feats)--stat-list[List stats found in file]'
'(--skill --stat --save --advantage --disadvantage --skill-list --stat-list)--skill-list[List skills found in file]' '(--skill --stat --save --advantage --disadvantage --skill-list --stat-list --feats)--skill-list[List skills found in file]'
'(--advantage --disadvantage)--advantage[Roll with advantage]' '(--advantage --disadvantage)--advantage[Roll with advantage]'
'(--advantage --disadvantage)--disadvantage[Roll with disadvantage]' '(--advantage --disadvantage)--disadvantage[Roll with disadvantage]'
'(--skill --save --stat --skill-list --stat-list -v --verbose)--stat[Roll a stat check]:stat to roll:(strength dexterity constitution intelligence wisdom charisma)' '(--skill --save --stat --skill-list --stat-list -v --verbose --feats)--stat[Roll a stat check]:stat to roll:(strength dexterity constitution intelligence wisdom charisma)'
'(--skill --save --stat --skill-list --stat-list -v --verbose)--save[Roll a saving throw]:stat to roll:(strength dexterity constitution intelligence wisdom charisma)' '(--skill --save --stat --skill-list --stat-list -v --verbose --feats)--save[Roll a saving throw]:stat to roll:(strength dexterity constitution intelligence wisdom charisma)'
'(--skill --save --stat --skill-list --stat-list -v --verbose)--skill[Roll a skill check]:stat to roll:(athletics acrobatics sleight_of_hand stealth arcana history investigation nature religion animal_handling insight medicine perception survival deception intimidation performance persuasion)' '(--skill --save --stat --skill-list --stat-list -v --verbose --feats)--skill[Roll a skill check]:stat to roll:(athletics acrobatics sleight_of_hand stealth arcana history investigation nature religion animal_handling insight medicine perception survival deception intimidation performance persuasion)'
) )
_arguments : $arguments _arguments : $arguments