diff --git a/def.go b/def.go index 27c66c2..aa42eed 100644 --- a/def.go +++ b/def.go @@ -416,14 +416,15 @@ type JobPayloadGWithdrawItem struct { } type JobPayloadGWithdraw struct { - MsgID64 int64 `json:"msg_id"` - ChatID64 int64 `json:"chat_id"` - UserID64 int64 `json:"user_id"` - Items []JobPayloadGWithdrawItem `json:"items"` - Status int64 `json:"status"` - CleanupMsg []ChatWarsMessage `json:"cleanup_msg"` - Validated bool `json:"validated"` - Inspecting string `json:"inspecting"` + MsgID64 int64 `json:"msg_id"` + ChatID64 int64 `json:"chat_id"` + UserID64 int64 `json:"user_id"` + VaultJobID64 int64 `json:"vault_job_id"` + Items []JobPayloadGWithdrawItem `json:"items"` + Status int64 `json:"status"` + CleanupMsg []ChatWarsMessage `json:"cleanup_msg"` + Validated bool `json:"validated"` + Inspecting string `json:"inspecting"` } type JobPayloadGDeposit struct { diff --git a/job.go b/job.go index b2dd12a..d6fdf60 100644 --- a/job.go +++ b/job.go @@ -1803,7 +1803,8 @@ func jobCraftItem(j Job) { err = json.Unmarshal(b, &p2) logOnError(err, "jobCraftItem : Unmarshal(p2)") - item = getObjItem(p.ObjItemID64) + item, err = getObjItem(p.ObjItemID64) + logOnError(err, "jobCraftItem : getObjItem") availableItems = make(map[string]int64) requiredItems = make(map[string]int64) missingItems = make(map[string]int64) @@ -1828,7 +1829,8 @@ func jobCraftItem(j Job) { missing, _ := missingItems[code] if (ava + craft + missing) < req { update = true - obj := getObjItem(getObjItemID(code, ``)) + obj, err := getObjItem(getObjItemID(code, ``)) + logOnError(err, "jobCraftItem : getObjItem") if obj.Craft != nil { craftItems[code] = req - ava totalMana = (req - ava) * obj.Craft.Mana @@ -1844,11 +1846,12 @@ func jobCraftItem(j Job) { } + log.Printf("jobCraftItem[%s] : Mana : %d\n", item.Code, totalMana) for code, req := range requiredItems { ava, _ := availableItems[code] craft, _ := craftItems[code] missing, _ := missingItems[code] - log.Printf("jobCraftItem[%s] : %s - Req : %d / Ava : %d / Craft : %d / Missing : %d\n", item.Code, v.Code, req, ava, craft, missing) + log.Printf("jobCraftItem[%s] : %s - Req : %d / Ava : %d / Craft : %d / Missing : %d\n", item.Code, code, req, ava, craft, missing) } /* we can finish the job */