little work on vault limit

This commit is contained in:
shoopea 2020-02-05 16:34:44 +08:00
parent 2645f8d092
commit 0b6bba71bd
2 changed files with 12 additions and 2 deletions

5
def.go
View File

@ -40,6 +40,11 @@ type Config struct {
Mainchat int64 `json:"main_chat_id"` Mainchat int64 `json:"main_chat_id"`
Depositchat int64 `json:"deposit_chat_id"` Depositchat int64 `json:"deposit_chat_id"`
Reportchat int64 `json:"report_chat_id"` Reportchat int64 `json:"report_chat_id"`
VaultLimit []struct {
Item string `json:"item"`
Min int64 `json:"min_qty"`
Max int64 `json:"max_qty"`
} `json:"vault_limit"`
} `json:"bot"` } `json:"bot"`
} }

9
job.go
View File

@ -2142,8 +2142,13 @@ func jobCheckVaultLimit(j Job) {
if p.Status == 0 { if p.Status == 0 {
p2.JobCallbackID64 = j.ID64 p2.JobCallbackID64 = j.ID64
p2.ItemTypeList = make([]int64, 0) p2.ItemTypeList = make([]int64, 0)
p2.ItemTypeList = append(p2.ItemTypeList, cacheObjSubType[`item_res`])
p2.ItemTypeList = append(p2.ItemTypeList, cacheObjSubType[`item_alch`]) for _, c := range cfg.Bot.VaultLimit {
o, err := getObjItem(getSilentObjItemID(c.Item, ``))
logOnError(err, "jobCheckVaultLimit : getObjItem")
p2.ItemTypeList = append(p2.ItemTypeList, o.ItemTypeID)
}
b, err = json.Marshal(p2) b, err = json.Marshal(p2)
logOnError(err, "jobCheckVaultLimit : Marshal(p2)") logOnError(err, "jobCheckVaultLimit : Marshal(p2)")