This commit is contained in:
shoopea 2019-06-28 19:14:25 +08:00
parent 187d7ca41f
commit 0d29bee4c1

4
obj.go
View File

@ -657,6 +657,7 @@ func silentGetObjItemID(code string, name string) int64 {
item := ChatWarsItem{
ObjID64: 0,
}
match := false
cacheObjItem.Range(func(k, v interface{}) bool {
item = v.(ChatWarsItem)
if ok, _ := regexp.MatchString(`^(a|e|w)[0-9]+$`, item.Code); !ok { //only gear can be custom named
@ -665,6 +666,7 @@ func silentGetObjItemID(code string, name string) int64 {
m := fmt.Sprintf("^((%s.*)|(.*%s))$", regexp.QuoteMeta(item.Name), regexp.QuoteMeta(item.Name))
if ok, _ := regexp.MatchString(m, basename); ok {
log.Printf("LOOP : Matching item modified basename %s with %s (%d).\n", basename, item.Name, item.ObjID64)
match = true
return false
} else {
log.Printf("Not matching item modified basename %s with %s (%d).\n", basename, item.Name, item.ObjID64)
@ -675,7 +677,7 @@ func silentGetObjItemID(code string, name string) int64 {
}
})
if item.ObjID64 != 0 {
if item.ObjID64 != 0 && match {
log.Printf("RETURN : Matching item modified basename %s with %s (%d).\n", basename, item.Name, item.ObjID64)
return item.ObjID64
} else {