This commit is contained in:
shoopea 2019-06-06 15:54:29 +08:00
parent 601e938ccb
commit af3ef63e49

9
obj.go
View File

@ -4,6 +4,7 @@ import (
"fmt"
"regexp"
"strconv"
"strings"
"sync"
"time"
)
@ -492,7 +493,7 @@ func addObjItem(code string, name string, itemTypeID64 int64, weight int) (int64
c := new(ChatWarsItem)
c.ObjID64 = objId
c.Code = code
c.Name = name
c.Name = strings.ToUpper(name)
c.Weight = weight
cacheObjItem.Store(code, *c)
cacheObjItem.Store(name, *c)
@ -513,7 +514,9 @@ func getObjItemID(c string, n string) int64 {
return i
}
func silentGetObjItemID(c string, n string) int64 {
func silentGetObjItemID(code string, name string) int64 {
c := string.ToLower(code)
n := string.ToUpper(name)
if v, ok := cacheObjItem.Load(c); ok {
i := v.(ChatWarsItem)
return i.ObjID64
@ -576,7 +579,7 @@ func loadObjItem() error {
c := new(ChatWarsItem)
c.ObjID64 = id
c.Code = intl_id
c.Name = name
c.Name = strings.ToUpper(name)
c.Weight = weight
cacheObjItem.Store(intl_id, *c)
cacheObjItem.Store(name, *c)