2019-06-02 15:23:10 +02:00
|
|
|
package main
|
|
|
|
|
2020-01-12 13:03:30 +01:00
|
|
|
import ()
|
2019-06-02 15:51:33 +02:00
|
|
|
|
2019-12-13 12:30:41 +01:00
|
|
|
func reloadObjItem(code string, name string, itemTypeID64 int64, weight int64, exchange bool, auction bool) {
|
2019-06-25 13:12:16 +02:00
|
|
|
var objID64 int64
|
2019-07-22 09:40:52 +02:00
|
|
|
objID64 = getSilentObjItemID(code, ``)
|
2019-06-25 13:11:48 +02:00
|
|
|
if objID64 == 0 {
|
2019-08-21 05:46:42 +02:00
|
|
|
id, err := addObjItem(code, name, itemTypeID64, weight, exchange, auction)
|
2019-06-25 13:13:53 +02:00
|
|
|
objID64 = id
|
2019-06-02 15:23:10 +02:00
|
|
|
logOnError(err, "reloadObjItem : addObjItem")
|
|
|
|
}
|
2019-07-22 09:40:52 +02:00
|
|
|
if getSilentObjItemID(``, name) == 0 {
|
2019-07-31 10:11:25 +02:00
|
|
|
//log.Printf("Adding %s to %d.\n", name, objID64)
|
2019-06-25 13:11:48 +02:00
|
|
|
objAddName(objID64, name)
|
2019-07-08 06:27:36 +02:00
|
|
|
c := new(ChatWarsItem)
|
|
|
|
c.ObjID64 = objID64
|
2019-08-23 12:34:27 +02:00
|
|
|
c.ItemTypeID = itemTypeID64
|
2019-07-08 06:27:36 +02:00
|
|
|
c.Code = code
|
2020-01-12 13:03:30 +01:00
|
|
|
c.Name = append(c.Name, name)
|
2019-07-08 06:27:36 +02:00
|
|
|
c.Weight = weight
|
2019-08-21 05:46:42 +02:00
|
|
|
c.Exchange = exchange
|
|
|
|
c.Auction = auction
|
2019-07-22 09:40:52 +02:00
|
|
|
|
|
|
|
muxObjItem.Lock()
|
2019-07-22 10:59:54 +02:00
|
|
|
cacheObjItem[name] = *c
|
2019-07-22 09:40:52 +02:00
|
|
|
muxObjItem.Unlock()
|
2019-06-25 13:11:48 +02:00
|
|
|
}
|
2019-08-21 05:46:42 +02:00
|
|
|
|
2019-06-02 15:23:10 +02:00
|
|
|
}
|