This commit is contained in:
Nox Sluijtman 2022-12-30 23:21:46 +01:00
parent 105843f53f
commit dbb4a164c5
2 changed files with 7 additions and 6 deletions

View file

@ -30,8 +30,8 @@ func handleError(err error) {
} }
} }
func readJson() { func ReadJson(envVar string) {
envPath, isSet := os.LookupEnv("CHARSHEET") envPath, isSet := os.LookupEnv(envVar)
switch { switch {
case len(pathFlag) > 0: case len(pathFlag) > 0:
path = pathFlag path = pathFlag
@ -142,7 +142,7 @@ func savingThrow(stat Stat) (int, int, error) {
return die + GetModifier(stat), plainDie, statErrorCheck() return die + GetModifier(stat), plainDie, statErrorCheck()
} }
func skillCheck(skill Skill) (int, int, error) { func SkillCheck(skill Skill) (int, int, error) {
die := rollDice() die := rollDice()
if char.Misc.ReliableTalent && skill.Proficient && die < 10 { if char.Misc.ReliableTalent && skill.Proficient && die < 10 {
die = 10 die = 10
@ -162,7 +162,7 @@ func skillCheck(skill Skill) (int, int, error) {
return die, plainDie, skillErrorCheck() return die, plainDie, skillErrorCheck()
} }
func printStatList(verbose bool) { func PrintStatList(verbose bool) {
color.Magenta("Listing stats...") color.Magenta("Listing stats...")
if verbose { if verbose {
var proficiency string var proficiency string
@ -184,7 +184,7 @@ func printStatList(verbose bool) {
} }
} }
func printSkillList(verbose bool) { func PrintSkillList(verbose bool) {
color.Magenta("Listing skills...") color.Magenta("Listing skills...")
var proficiency string var proficiency string
var expertise string var expertise string

View file

@ -11,6 +11,7 @@ import (
"github.com/fatih/color" "github.com/fatih/color"
"gitlab.com/EternalWanderer/dice-roller/Dice" "gitlab.com/EternalWanderer/dice-roller/Dice"
"gitlab.com/EternalWanderer/sheet-parser/v2/Parser"
) )
const exampleFile string = "/etc/sheet-parser/example.json" const exampleFile string = "/etc/sheet-parser/example.json"
@ -88,7 +89,7 @@ func initMaps() {
func main() { func main() {
parseFlags() parseFlags()
readJson() char := Parser.ReadJson("CHARSHEET")
initMaps() initMaps()
switch { switch {