This commit is contained in:
shoopea 2020-01-27 13:10:31 +08:00
parent 33a957b4ce
commit 0f3b39295d
3 changed files with 349 additions and 7 deletions

File diff suppressed because it is too large Load Diff

1
def.go
View File

@ -135,6 +135,7 @@ type ChatWarsItem struct {
Weight int64 `json:"weight"`
Exchange string `json:"exchange"`
Auction bool `json:"auction"`
Craftable bool `json:"craftable"`
Craft *ChatWarsItemCraft `json:"craft"`
}

16
job.go
View File

@ -1842,7 +1842,9 @@ func jobCraftItem(j Job) {
requiredItems[v.Code] = req2 + v.Quantity*(req-ava)
}
} else {
log.Printf("Item not craftable : %s\n", code)
if obj.Craftable {
log.Printf("Item missing recipe : %s\n", code)
}
missingItems[code] = req - ava
}
}
@ -1955,7 +1957,7 @@ func jobGetVault(j Job) {
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_res_req`])
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`])
rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC())
clientSendCWMsg(j.UserID64, `/g_stock_res`)
clientSendCWMsgDelay(j.UserID64, `/g_stock_res`, 4)
return
} else if (p.Status & reqTab[cacheObjSubType[`item_alch`]]) == reqTab[cacheObjSubType[`item_alch`]] {
p.Status = p.Status &^ reqTab[cacheObjSubType[`item_alch`]]
@ -1964,7 +1966,7 @@ func jobGetVault(j Job) {
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_alch_req`])
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`])
rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC())
clientSendCWMsg(j.UserID64, `/g_stock_alch`)
clientSendCWMsgDelay(j.UserID64, `/g_stock_alch`, 4)
return
} else if (p.Status & reqTab[cacheObjSubType[`item_misc`]]) == reqTab[cacheObjSubType[`item_misc`]] {
p.Status = p.Status &^ reqTab[cacheObjSubType[`item_misc`]]
@ -1973,7 +1975,7 @@ func jobGetVault(j Job) {
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_misc_req`])
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`])
rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC())
clientSendCWMsg(j.UserID64, `/g_stock_misc`)
clientSendCWMsgDelay(j.UserID64, `/g_stock_misc`, 4)
return
} else if (p.Status & reqTab[cacheObjSubType[`item_recipe`]]) == reqTab[cacheObjSubType[`item_recipe`]] {
p.Status = p.Status &^ reqTab[cacheObjSubType[`item_recipe`]]
@ -1982,7 +1984,7 @@ func jobGetVault(j Job) {
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_rec_req`])
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`])
rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC())
clientSendCWMsg(j.UserID64, `/g_stock_rec`)
clientSendCWMsgDelay(j.UserID64, `/g_stock_rec`, 4)
return
} else if (p.Status & reqTab[cacheObjSubType[`item_part`]]) == reqTab[cacheObjSubType[`item_part`]] {
p.Status = p.Status &^ reqTab[cacheObjSubType[`item_part`]]
@ -1991,7 +1993,7 @@ func jobGetVault(j Job) {
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_part_req`])
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`])
rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC())
clientSendCWMsg(j.UserID64, `/g_stock_parts`)
clientSendCWMsgDelay(j.UserID64, `/g_stock_parts`, 4)
return
} else if (p.Status & reqTab[cacheObjSubType[`item_other`]]) == reqTab[cacheObjSubType[`item_other`]] {
p.Status = p.Status &^ reqTab[cacheObjSubType[`item_other`]]
@ -2000,7 +2002,7 @@ func jobGetVault(j Job) {
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_oth_req`])
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`])
rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC())
clientSendCWMsg(j.UserID64, `/g_stock_other`)
clientSendCWMsgDelay(j.UserID64, `/g_stock_other`, 4)
return
} else {
setJobPayloadJSON(j.ID64, p)