add more items for the dummy load evaluation

This commit is contained in:
Héctor Giménez
2024-05-05 14:00:30 +09:00
parent 5dc9f42969
commit 7af19bd16a

View File

@@ -47,10 +47,17 @@ func ParseNIPFile(filePath string) (Rules, error) {
rules := make([]Rule, 0) rules := make([]Rule, 0)
lineNumber := 0 lineNumber := 0
dummyItem := data.Item{ dummyItems := []data.Item{
ID: 516, {
Name: "healingpotion", ID: 373,
Quality: item.QualityNormal, Name: "mageplate",
Quality: item.QualityUnique,
},
{
ID: 0,
Name: "handaxe",
Quality: item.QualityUnique,
},
} }
for fileScanner.Scan() { for fileScanner.Scan() {
@@ -64,10 +71,13 @@ func ParseNIPFile(filePath string) (Rules, error) {
} }
// We evaluate all the rules at startup to ensure no format errors, if there is a format error we will throw it now instead of during runtime // We evaluate all the rules at startup to ensure no format errors, if there is a format error we will throw it now instead of during runtime
_, err = rule.Evaluate(dummyItem) for _, it := range dummyItems {
_, err = rule.Evaluate(it)
if err != nil { if err != nil {
return nil, fmt.Errorf("error testing rule on [%s:%d]: %w", filePath, lineNumber, err) return nil, fmt.Errorf("error testing rule on [%s:%d]: %w", filePath, lineNumber, err)
} }
}
rules = append(rules, rule) rules = append(rules, rule)
} }