update object matching for quality

This commit is contained in:
shoopea 2019-12-13 20:08:08 +08:00
parent e8c284b686
commit 43cc18301a

5
obj.go
View File

@ -735,6 +735,11 @@ func getSilentObjItemID(code string, name string) int64 {
//log.Printf("Matching item name %s with %s.\n", name, obj.Name) //log.Printf("Matching item name %s with %s.\n", name, obj.Name)
return obj.ObjID64 return obj.ObjID64
} }
if ok, _ := regexp.MatchString(`^a[0-9]+[a-e])$`, code); ok {
if obj, ok := cacheObjItem[code[:len(code)-1]]; ok {
return obj.ObjID64
}
}
if ok, _ := regexp.MatchString(`^((u|e)[0-9]+|(a|w)[0-9]+[a-e]{0,1})$`, code); ok || len(code) == 0 { if ok, _ := regexp.MatchString(`^((u|e)[0-9]+|(a|w)[0-9]+[a-e]{0,1})$`, code); ok || len(code) == 0 {
r := regexp.MustCompile(`^((?P<Modifier>⚡\+[0-9]+) ){0,1}(?P<BaseName>.+?)( \+(?P<Atk>[0-9]+)⚔){0,1}( \+(?P<Def>[0-9]+)🛡){0,1}( \+(?P<Mana>[0-9]+)💧){0,1}$`) r := regexp.MustCompile(`^((?P<Modifier>⚡\+[0-9]+) ){0,1}(?P<BaseName>.+?)( \+(?P<Atk>[0-9]+)⚔){0,1}( \+(?P<Def>[0-9]+)🛡){0,1}( \+(?P<Mana>[0-9]+)💧){0,1}$`)
basename := r.ReplaceAllString(name, "${BaseName}") basename := r.ReplaceAllString(name, "${BaseName}")