update quality obj code matching

This commit is contained in:
shoopea 2019-12-13 20:13:57 +08:00
parent 9afb5345ac
commit 67ab18d177

14
obj.go
View File

@ -724,6 +724,13 @@ func getSilentObjItemID(code string, name string) int64 {
//log.Printf("Matching item code %s with %s.\n", code, obj.Code)
return obj.ObjID64
}
if ok, _ := regexp.MatchString(`^a[0-9]+[a-e]$`, code); ok {
code2 := code[:len(code)-1]
log.Printf("Matching quality item code %s with %s.\n", code, code2)
if obj, ok := cacheObjItem[code2]; ok {
return obj.ObjID64
}
}
if ok, _ := regexp.MatchString(`^u[0-9]+`, code); !ok {
return 0
}
@ -735,13 +742,6 @@ func getSilentObjItemID(code string, name string) int64 {
//log.Printf("Matching item name %s with %s.\n", name, obj.Name)
return obj.ObjID64
}
if ok, _ := regexp.MatchString(`^a[0-9]+[a-e]$`, code); ok {
code2 := code[:len(code)-1]
log.Printf("Matching quality item code %s with %s.\n", code, code2)
if obj, ok := cacheObjItem[code2]; 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 {
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}")