This commit is contained in:
shoopea 2019-06-25 19:23:35 +08:00
parent b64e75bb10
commit 3fc8c68631

8
obj.go
View File

@ -643,7 +643,7 @@ func silentGetObjItemID(code string, name string) int64 {
} }
if v, ok := cacheObjItem.Load(name); ok { if v, ok := cacheObjItem.Load(name); ok {
item := v.(ChatWarsItem) item := v.(ChatWarsItem)
//log.Printf("Matching item name %s with %s.\n", name, item.Name) log.Printf("Matching item name %s with %s.\n", name, item.Name)
return item.ObjID64 return item.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 {
@ -651,7 +651,7 @@ func silentGetObjItemID(code string, name string) int64 {
basename := r.ReplaceAllString(name, "${BaseName}") basename := r.ReplaceAllString(name, "${BaseName}")
if v, ok := cacheObjItem.Load(basename); ok && len(basename) > 0 { if v, ok := cacheObjItem.Load(basename); ok && len(basename) > 0 {
item := v.(ChatWarsItem) item := v.(ChatWarsItem)
//log.Printf("Matching item full basename %s with %s.\n", basename, item.Name) log.Printf("Matching item full basename %s with %s.\n", basename, item.Name)
return item.ObjID64 return item.ObjID64
} }
item := ChatWarsItem{ item := ChatWarsItem{
@ -664,7 +664,7 @@ func silentGetObjItemID(code string, name string) int64 {
} }
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 { if ok, _ := regexp.MatchString(m, basename); ok {
//log.Printf("Matching item modified basename %s with %s. (1)\n", basename, item.Name) log.Printf("Matching item modified basename %s with %s. (1)\n", basename, item.Name)
return false return false
} else { } else {
item = ChatWarsItem{ item = ChatWarsItem{
@ -675,7 +675,7 @@ func silentGetObjItemID(code string, name string) int64 {
}) })
if item.ObjID64 != 0 { if item.ObjID64 != 0 {
//log.Printf("Matching item modified basename %s with %s. (2)\n", basename, item.Name) log.Printf("Matching item modified basename %s with %s. (2)\n", basename, item.Name)
return item.ObjID64 return item.ObjID64
} else { } else {
fmt.Printf("silentGetObjItemID : Modifier : `%s`\n", r.ReplaceAllString(name, "${Modifier}")) fmt.Printf("silentGetObjItemID : Modifier : `%s`\n", r.ReplaceAllString(name, "${Modifier}"))