mirror of
https://gitlab.com/EternalWanderer/sheet-parser.git
synced 2024-11-28 21:13:51 +01:00
Functionality to print verbose lists
This commit is contained in:
parent
e09604a832
commit
b650634d47
53
main.go
53
main.go
|
@ -12,13 +12,13 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
path, skillString, saveString, statString string
|
||||
modifier, diceThrows, surfaces int
|
||||
X, Y int
|
||||
char Character
|
||||
skillMap = make(map[string]int)
|
||||
statMap = make(map[string]int)
|
||||
advantage, disadvantage, stat_list, skill_list bool
|
||||
path, skillString, saveString, statString string
|
||||
modifier, diceThrows, surfaces int
|
||||
X, Y int
|
||||
char Character
|
||||
skillMap = make(map[string]int)
|
||||
statMap = make(map[string]int)
|
||||
advantage, disadvantage, stat_list, skill_list, verbose bool
|
||||
)
|
||||
|
||||
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(&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()
|
||||
}
|
||||
|
@ -72,6 +74,42 @@ func main() {
|
|||
initMaps()
|
||||
|
||||
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:
|
||||
for i := 0; i < len(char.Stats); i++ {
|
||||
fmt.Println(char.Stats[i].StatName)
|
||||
|
@ -80,6 +118,7 @@ func main() {
|
|||
for i := 0; i < len(char.Skills); i++ {
|
||||
fmt.Println(char.Skills[i].SkillName)
|
||||
}
|
||||
|
||||
case advantage && disadvantage:
|
||||
fmt.Println("You can't roll with both advantage and disadvantage")
|
||||
os.Exit(1)
|
||||
|
|
Loading…
Reference in a new issue