update data

This commit is contained in:
shoopea 2020-04-18 12:18:01 +08:00
parent eb7d74d601
commit 1f74136180
3 changed files with 241 additions and 237 deletions

View File

@ -0,0 +1,136 @@
[
{
"item_type": "item_res",
"code": "01",
"weight": 1,
"exchange": "/t_01",
"auction": false,
"craftable": false,
"names": [
"Thread"
]
},
{
"item_type": "item_res",
"code": "02",
"weight": 1,
"exchange": "/t_02",
"auction": false,
"craftable": false,
"names": [
"Stick"
]
},
{
"item_type": "item_res",
"code": "03",
"weight": 1,
"exchange": "/t_03",
"auction": false,
"craftable": false,
"names": [
"Pelt"
]
},
{
"item_type": "item_res",
"code": "04",
"weight": 1,
"exchange": "/t_04",
"auction": false,
"craftable": false,
"names": [
"Bone"
]
},
{
"item_type": "item_res",
"code": "05",
"weight": 1,
"exchange": "/t_05",
"auction": false,
"craftable": false,
"names": [
"Coal"
]
},
{
"item_type": "item_res",
"code": "06",
"weight": 1,
"exchange": "/t_06",
"auction": false,
"craftable": false,
"names": [
"Charcoal"
]
},
{
"item_type": "item_res",
"code": "07",
"weight": 1,
"exchange": "/t_07",
"auction": false,
"craftable": false,
"names": [
"Powder"
]
},
{
"item_type": "item_res",
"code": "08",
"weight": 2,
"exchange": "/t_08",
"auction": false,
"craftable": false,
"names": [
"Iron Ore",
"Iron ore"
]
},
{
"item_type": "item_res",
"code": "09",
"weight": 1,
"exchange": "/t_09",
"auction": false,
"craftable": false,
"names": [
"Cloth"
]
},
{
"item_type": "item_res",
"code": "10",
"weight": 2,
"exchange": "/t_10",
"auction": false,
"craftable": false,
"names": [
"Silver Ore",
"Silver ore"
]
},
{
"item_type": "item_res",
"code": "100",
"weight": 0,
"exchange": "",
"auction": false,
"craftable": true,
"names": [
"Pouch of Gold"
]
},
{
"item_type": "item_res",
"code": "11",
"weight": 2,
"exchange": "/t_11",
"auction": false,
"craftable": false,
"names": [
"Bauxite"
]
}
]

View File

@ -1,138 +1,4 @@
[
{
"item_type": "item_res",
"code": "01",
"weight": 1,
"exchange": "/t_01",
"auction": false,
"craftable": false,
"names": [
"Thread"
]
},
{
"item_type": "item_res",
"code": "02",
"weight": 1,
"exchange": "/t_02",
"auction": false,
"craftable": false,
"names": [
"Stick"
]
},
{
"item_type": "item_res",
"code": "03",
"weight": 1,
"exchange": "/t_03",
"auction": false,
"craftable": false,
"names": [
"Pelt"
]
},
{
"item_type": "item_res",
"code": "04",
"weight": 1,
"exchange": "/t_04",
"auction": false,
"craftable": false,
"names": [
"Bone"
]
},
{
"item_type": "item_res",
"code": "05",
"weight": 1,
"exchange": "/t_05",
"auction": false,
"craftable": false,
"names": [
"Coal"
]
},
{
"item_type": "item_res",
"code": "06",
"weight": 1,
"exchange": "/t_06",
"auction": false,
"craftable": false,
"names": [
"Charcoal"
]
},
{
"item_type": "item_res",
"code": "07",
"weight": 1,
"exchange": "/t_07",
"auction": false,
"craftable": false,
"names": [
"Powder"
]
},
{
"item_type": "item_res",
"code": "08",
"weight": 2,
"exchange": "/t_08",
"auction": false,
"craftable": false,
"names": [
"Iron Ore",
"Iron ore"
]
},
{
"item_type": "item_res",
"code": "09",
"weight": 1,
"exchange": "/t_09",
"auction": false,
"craftable": false,
"names": [
"Cloth"
]
},
{
"item_type": "item_res",
"code": "10",
"weight": 2,
"exchange": "/t_10",
"auction": false,
"craftable": false,
"names": [
"Silver Ore",
"Silver ore"
]
},
{
"item_type": "item_res",
"code": "100",
"weight": 0,
"exchange": "",
"auction": false,
"craftable": true,
"names": [
"Pouch of Gold"
]
},
{
"item_type": "item_res",
"code": "11",
"weight": 2,
"exchange": "/t_11",
"auction": false,
"craftable": false,
"names": [
"Bauxite"
]
},
{
"item_type": "item_res",
"code": "12",

14
item.go
View File

@ -283,6 +283,7 @@ func loadObjItem() error {
name string
weight int64
craftable int
objItemsBuf []ChatWarsItem
)
muxObjItem.Lock()
@ -295,15 +296,20 @@ func loadObjItem() error {
for _, a := range AssetNames() {
m, err := regexp.MatchString("data/obj_item/.*\\.json", a)
logOnError(err, "loadObjItem : MatchString")
itemsBefore := len(objItems)
if m {
b, err := Asset(a)
logOnError(err, "loadObjItem : load Asset("+a+")")
if err != nil {
return err
}
objItemsBuf = make([]ChatWarsItem, 0)
err = json.Unmarshal(b, &objItemsBuf)
objItems = append(objItems, objItemsBuf)
log.Printf("%d items parsed from %s.\n", len(objItemsBuf), a)
}
}
err = json.Unmarshal(b, &objItems)
var k int64
for k = 0; k < int64(len(objItems)); k++ {
if len(objItems[k].Names) == 0 {
@ -410,10 +416,6 @@ func loadObjItem() error {
}
}
log.Printf("%d items loaded for %s.\n", len(objItems)-itemsBefore, a)
}
}
log.Printf("%d items loaded.\n", len(objItems))
/*