This commit is contained in:
shoopea 2020-01-28 17:54:26 +08:00
parent 8d5ce121b1
commit f144911d4d
2 changed files with 17 additions and 3 deletions

1
bot.go
View File

@ -964,6 +964,7 @@ func botGDepositAll(m *tb.Message) {
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`23`, `Coke`))
}
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`24`, `Purified Powder`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`28`, `Silver mold`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`31`, `Rope`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`33`, `Metal Plate`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`34`, `Metallic Fiber`))

19
job.go
View File

@ -1405,6 +1405,7 @@ func jobGWithdraw(j Job) {
p JobPayloadGWithdraw
p2 JobPayloadGetVault
b []byte
vault map[string]int64
)
log.Printf("jobGWithdraw[%d] : Starting.\n", j.ID64)
@ -1438,9 +1439,6 @@ func jobGWithdraw(j Job) {
p.Status = 1
p.VaultJobID64 = jobID64
b, err = json.Marshal(p)
logOnError(err, "jobGWithdraw : Marshal(p)")
err = setJobPayloadJSON(j.ID64, p)
logOnError(err, "jobGWithdraw : setJobPayloadJSON(p)")
@ -1448,6 +1446,21 @@ func jobGWithdraw(j Job) {
return
} else if p.Status == 1 {
/* loop through items and get unique/inspect */
b = getJobPayload(p.VaultJobID64)
err = json.Unmarshal(b, &p2)
logOnError(err, "jobGStock : Unmarshal(p2)")
vault = make(map[string]int64)
for _, i := range p2.Vault {
vault[i.Code] = i.Quantity
}
for k, req := range p.Items {
ava, _ := vault[req.Code]
p.Items[k].Available = ava
if ava == 0 && regexp.MustMatch()
}
}
if j.Trigger != 0 {