NIP parser v2 (#17)

This commit is contained in:
Héctor Giménez
2024-05-05 12:15:08 +09:00
committed by GitHub
parent 0d5c108721
commit bb0ec2555d
28 changed files with 56618 additions and 1385 deletions

View File

@@ -12,7 +12,6 @@ import (
"github.com/hectorgimenez/d2go/pkg/data"
"github.com/hectorgimenez/d2go/pkg/data/area"
"github.com/hectorgimenez/d2go/pkg/data/item"
"github.com/hectorgimenez/d2go/pkg/itemfilter"
"github.com/hectorgimenez/d2go/pkg/memory"
"github.com/hectorgimenez/d2go/pkg/nip"
)
@@ -55,9 +54,15 @@ func (w *Watcher) Start(ctx context.Context) error {
d := w.gr.GetData()
for _, i := range d.Items.ByLocation(item.LocationGround) {
_, match := itemfilter.Evaluate(i, w.rules)
if !match {
continue
for _, r := range w.rules {
match, err := r.Evaluate(i)
if err != nil {
log.Printf("error evaluating rule: %v", err)
continue
}
if !match {
continue
}
}
found := false