add function to skip tier rules when evaluating

This commit is contained in:
adpist
2025-10-16 23:33:18 +02:00
parent cfcc94c874
commit f3263ba4f8

View File

@@ -65,6 +65,31 @@ func (r Rules) EvaluateAll(it data.Item) (Rule, RuleResult) {
return bestMatchingRule, bestMatch
}
func (r Rules) EvaluateAllIgnoreTiers(it data.Item) (Rule, RuleResult) {
bestMatch := RuleResultNoMatch
bestMatchingRule := Rule{}
for _, rule := range r {
if rule.Enabled {
if rule.tier > 0 || rule.mercTier > 0 {
continue
}
result, err := rule.Evaluate(it)
if err != nil {
continue
}
if result == RuleResultFullMatch {
return rule, result
}
if result == RuleResultPartial {
bestMatch = result
bestMatchingRule = rule
}
}
}
return bestMatchingRule, bestMatch
}
func (r Rules) EvaluateTiers(it data.Item, tierRulesIndexes []int) (Rule, Rule) {
highestTierRule := Rule{}
highestMercTierRule := Rule{}