This commit is contained in:
shoopea 2019-06-25 18:23:42 +08:00
parent 12f3955c01
commit 9e524a5286

7
obj.go
View File

@ -649,7 +649,7 @@ func silentGetObjItemID(code string, name string) int64 {
basename := r.ReplaceAllString(name, "${BaseName}")
if v, ok := cacheObjItem.Load(basename); ok && len(basename) > 0 {
item := v.(ChatWarsItem)
log.Printf("Matching item basename %s with %s.\n", basename, item.Name)
//log.Printf("Matching item full basename %s with %s.\n", basename, item.Name)
return item.ObjID64
}
item := ChatWarsItem{
@ -660,8 +660,9 @@ func silentGetObjItemID(code string, name string) int64 {
if ok, _ := regexp.MatchString(`^(a|e|w)[0-9]+$`, item.Code); !ok { //only gear can be custom named
return true
}
m := fmt.Sprintf("^(%s.*|.*%s)$", regexp.QuoteMeta(item.Name), regexp.QuoteMeta(item.Name))
m := fmt.Sprintf("^((%s.*)|(.*%s))$", regexp.QuoteMeta(item.Name), regexp.QuoteMeta(item.Name))
if ok, _ := regexp.MatchString(m, basename); ok {
//log.Printf("Matching item modified basename %s with %s. (1)\n", basename, item.Name)
return false
} else {
item = ChatWarsItem{
@ -672,7 +673,7 @@ func silentGetObjItemID(code string, name string) int64 {
})
if item.ObjID64 != 0 {
log.Printf("Matching item modified basename %s with %s.\n", basename, item.Name)
//log.Printf("Matching item modified basename %s with %s. (2)\n", basename, item.Name)
return item.ObjID64
} else {
fmt.Printf("silentGetObjItemID : Modifier : `%s`\n", r.ReplaceAllString(name, "${Modifier}"))