This commit is contained in:
shoopea 2020-01-12 20:11:42 +08:00
parent ebece6e98f
commit b189743697

4
obj.go
View File

@ -915,7 +915,7 @@ func getSilentObjItemID(code string, name string) int64 {
} }
for _, obj := range cacheObjItem { for _, obj := range cacheObjItem {
if ok, _ := regexp.MatchString(`^(a|e|w)[0-9]+$`, obj.Code); ok { //only gear can be custom named if ok, _ := regexp.MatchString(`^(a|e|w)[0-9]+$`, obj.Code); ok { //only gear can be custom named
m := fmt.Sprintf("^((%s.*)|(.*%s))$", regexp.QuoteMeta(obj.Name), regexp.QuoteMeta(obj.Name)) m := fmt.Sprintf("^((%s.*)|(.*%s))$", regexp.QuoteMeta(obj.Names[0]), regexp.QuoteMeta(obj.Names[0]))
if ok, _ := regexp.MatchString(m, basename); ok { if ok, _ := regexp.MatchString(m, basename); ok {
//log.Printf("LOOP : Matching item modified basename %s with %s (%d).\n", basename, item.Name, item.ObjID64) //log.Printf("LOOP : Matching item modified basename %s with %s (%d).\n", basename, item.Name, item.ObjID64)
i = obj i = obj
@ -963,7 +963,7 @@ func loadObjItem2() error {
err = json.Unmarshal(b, &items) err = json.Unmarshal(b, &items)
for _, i := range items { for _, i := range items {
id := 0 var int64 id := 0
for _, n := range i.Names { for _, n := range i.Names {
if id == 0 { if id == 0 {
id = getSilentObjItemID(i.Code, ``) id = getSilentObjItemID(i.Code, ``)