-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathcfg.go
More file actions
91 lines (85 loc) · 3.39 KB
/
Copy pathcfg.go
File metadata and controls
91 lines (85 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package config
import (
"encoding/json"
"io/ioutil"
)
// RandomOptions are the options for the randomizer
type RandomOptions struct {
Randomize bool `json:"Randomize"`
UseSeed bool `json:"UseSeed"`
Seed int64 `json:"Seed"`
IsBalanced bool `json:"IsBalanced"` // Allows Props only from items up to 10 levels higher
BalancedPropCount bool `json:"BalancedPropCount"` // Picks prop count from a vanilla item up to 10 levels higher
AllowDupProps bool `json:"AllowDuplicateProps"` // Allow two props of the same type to be placed on an item
MinProps int `json:"MinProps"` // minimum number of non blank props on an item
MaxProps int `json:"MaxProps"` // maximum number of non blank props on an item
UseOSkills bool `json:"UseOSkills"` // +3 Fireball (Sorceress Only) -> +3 Fireball
PerfectProps bool `json:"PerfectProps"` // sets min/max to max
ElementalSkills bool `json:"ElementalSkills"`
}
// data is the configuration used to build the mod
type Data struct {
Version string `json:"Version"`
SourceDir string `json:"SourceDir"`
OutputDir string `json:"OutputDir"`
MeleeSplash bool `json:"MeleeSplash"`
IncreaseStackSizes bool `json:"IncreaseStackSizes"`
IncreaseMonsterDensity float64 `json:"IncreaseMonsterDensity"`
EnableTownSkills bool `json:"EnableTownSkills"`
NoDropZero bool `json:"NoDropZero"`
QuestDrops bool `json:"QuestDrops"`
UniqueItemDropRate float64 `json:"UniqueItemDropRate"`
RuneDropRate float64 `json:"RuneDropRate"`
StartWithCube bool `json:"StartWithCube"`
Cowzzz bool `json:"Cowzzz"`
RemoveLevelRequirements bool `json:"RemoveLevelRequirements"`
RemoveAttRequirements bool `json:"RemoveAttRequirements"`
RemoveUniqCharmLimit bool `json:"RemoveUniqCharmLimit"`
EnterToExit bool `json:"EnterToExit"`
RandomOptions RandomOptions `json:"RandomOptions"`
}
func DefaultData() Data {
return Data{
Version: "v0.5.4",
SourceDir: "",
OutputDir: "",
MeleeSplash: true,
IncreaseStackSizes: true,
IncreaseMonsterDensity: 1,
EnableTownSkills: true,
NoDropZero: true,
QuestDrops: true,
UniqueItemDropRate: 1,
RuneDropRate: 1,
StartWithCube: true,
Cowzzz: true,
RemoveLevelRequirements: false,
RemoveAttRequirements: false,
RemoveUniqCharmLimit: false,
EnterToExit: false,
RandomOptions: RandomOptions{
Randomize: false,
UseSeed: false,
Seed: -1,
IsBalanced: true,
BalancedPropCount: true,
AllowDupProps: false,
MinProps: 0,
MaxProps: 20,
UseOSkills: true,
PerfectProps: false,
},
}
}
// ReadCfg reads a ModConfig from the given json file
func Read(filePath string) Data {
file, _ := ioutil.ReadFile(filePath)
data := DefaultData()
_ = json.Unmarshal([]byte(file), &data)
return data
}
func Parse(jsonData []byte) Data {
data := DefaultData()
_ = json.Unmarshal(jsonData, &data)
return data
}