chirpnest/items.go
2020-01-12 19:43:45 +08:00

33 lines
734 B
Go

package main
import (
"log"
)
func reloadObjItem(code string, name string, itemTypeID64 int64, weight int64, exchange bool, auction bool) {
var objID64 int64
objID64 = getSilentObjItemID(code, ``)
if objID64 == 0 {
id, err := addObjItem(code, name, itemTypeID64, weight, exchange, auction)
objID64 = id
logOnError(err, "reloadObjItem : addObjItem")
}
if getSilentObjItemID(``, name) == 0 {
//log.Printf("Adding %s to %d.\n", name, objID64)
objAddName(objID64, name)
c := new(ChatWarsItem)
c.ObjID64 = objID64
c.ItemTypeID = itemTypeID64
c.Code = code
c.Name = name
c.Weight = weight
c.Exchange = exchange
c.Auction = auction
muxObjItem.Lock()
cacheObjItem[name] = *c
muxObjItem.Unlock()
}
}