mirror of
https://gitlab.com/EternalWanderer/sheet-parser.git
synced 2024-11-29 05:23:49 +01:00
Functionality to print verbose lists
This commit is contained in:
parent
e09604a832
commit
b650634d47
41
main.go
41
main.go
|
@ -18,7 +18,7 @@ var (
|
||||||
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 bool
|
advantage, disadvantage, stat_list, skill_list, verbose bool
|
||||||
)
|
)
|
||||||
|
|
||||||
func parseFlags() {
|
func parseFlags() {
|
||||||
|
@ -33,6 +33,8 @@ func parseFlags() {
|
||||||
|
|
||||||
flag.BoolVar(&stat_list, "stat-list", false, "Print list of stats, can also be used with -save flag")
|
flag.BoolVar(&stat_list, "stat-list", false, "Print list of stats, can also be used with -save flag")
|
||||||
flag.BoolVar(&skill_list, "skill-list", false, "Print list of skills to be used in combination with the -skill flag")
|
flag.BoolVar(&skill_list, "skill-list", false, "Print list of skills to be used in combination with the -skill flag")
|
||||||
|
flag.BoolVar(&verbose, "verbose", false, "Print stat numbers, to be used in combination with -stat-list or -skill-list")
|
||||||
|
flag.BoolVar(&verbose, "v", false, "Print stat numbers, to be used in combination with -stat-list or -skill-list")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
}
|
}
|
||||||
|
@ -72,6 +74,42 @@ func main() {
|
||||||
initMaps()
|
initMaps()
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
|
|
||||||
|
case stat_list && verbose:
|
||||||
|
var proficiency string
|
||||||
|
for i := 0; i < len(char.Stats); i++ {
|
||||||
|
name := char.Stats[i].StatName
|
||||||
|
isProficient := char.Stats[i].Proficient
|
||||||
|
if isProficient {
|
||||||
|
proficiency = "Proficient"
|
||||||
|
} else {
|
||||||
|
proficiency = "Not proficient"
|
||||||
|
}
|
||||||
|
score := char.Stats[i].Score
|
||||||
|
fmt.Printf("Stat: %s\t%s\tStat score: %d\tStat modifier: %d\n", name, proficiency, score, getModifier(char.Stats[i]))
|
||||||
|
}
|
||||||
|
case skill_list && verbose:
|
||||||
|
var proficiency string
|
||||||
|
var expertise string
|
||||||
|
|
||||||
|
for i := 0; i < len(char.Skills); i++ {
|
||||||
|
name := char.Skills[i].SkillName
|
||||||
|
localModifier := getModifier(getStat(char.Skills[i].BaseStat))
|
||||||
|
if char.Skills[i].Proficient {
|
||||||
|
proficiency = "Proficient"
|
||||||
|
localModifier += getProficiency()
|
||||||
|
} else {
|
||||||
|
proficiency = "Not proficient"
|
||||||
|
}
|
||||||
|
if char.Skills[i].Expertise {
|
||||||
|
expertise = "Has expertise"
|
||||||
|
localModifier += getProficiency()
|
||||||
|
} else {
|
||||||
|
expertise = "Doesn't have expertise"
|
||||||
|
}
|
||||||
|
fmt.Printf("Skill: %s\t%s\t%s\tSkill modifier: %d\n", name, proficiency, expertise, localModifier)
|
||||||
|
}
|
||||||
|
|
||||||
case stat_list:
|
case stat_list:
|
||||||
for i := 0; i < len(char.Stats); i++ {
|
for i := 0; i < len(char.Stats); i++ {
|
||||||
fmt.Println(char.Stats[i].StatName)
|
fmt.Println(char.Stats[i].StatName)
|
||||||
|
@ -80,6 +118,7 @@ func main() {
|
||||||
for i := 0; i < len(char.Skills); i++ {
|
for i := 0; i < len(char.Skills); i++ {
|
||||||
fmt.Println(char.Skills[i].SkillName)
|
fmt.Println(char.Skills[i].SkillName)
|
||||||
}
|
}
|
||||||
|
|
||||||
case advantage && disadvantage:
|
case advantage && disadvantage:
|
||||||
fmt.Println("You can't roll with both advantage and disadvantage")
|
fmt.Println("You can't roll with both advantage and disadvantage")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
Loading…
Reference in a new issue