This commit is contained in:
shoopea 2020-04-18 21:42:46 +08:00
parent edca865e37
commit f2ff1eb08d

10
item.go
View File

@ -334,6 +334,8 @@ func loadObjItem() error {
}
}
log.Printf("Duplicate check done...\n")
objs, err := db.Query(`SELECT oi.obj_id, o.obj_sub_type_id, oi.intl_id, oi.weight, oi.craftable FROM obj o, obj_item oi WHERE o.id = oi.obj_id;`)
if err != nil {
logOnError(err, "loadObjItem : querying items")
@ -367,6 +369,8 @@ func loadObjItem() error {
}
}
log.Printf("Loading existing items done...\n")
names, err := db.Query(`SELECT oi.obj_id, obn.name FROM obj_item oi, obj_name obn WHERE oi.obj_id = obn.obj_id;`)
if err != nil {
logOnError(err, "loadObjItem : querying names")
@ -387,6 +391,8 @@ func loadObjItem() error {
}
}
log.Printf("Loading existing names done...\n")
for _, i := range cacheObjItem {
if objItems[i].ObjID64 == 0 {
log.Printf("loadObjItem : adding %s (%s)\n", objItems[i].Names[0], objItems[i].Code)
@ -402,6 +408,8 @@ func loadObjItem() error {
}
}
log.Printf("Adding new objects done...\n")
for _, i := range cacheObjItem {
if objItems[i].Craft != nil {
cacheObjItemCraft[objItems[i].Craft.Command] = i
@ -421,6 +429,8 @@ func loadObjItem() error {
}
}
log.Printf("Adding new crafts done...\n")
log.Printf("%d items loaded.\n", len(objItems))
/*