diff --git a/job.go b/job.go index 341d396..8a86ba4 100644 --- a/job.go +++ b/job.go @@ -803,29 +803,39 @@ func jobGStock(j Job) { item, err := getObjItem(v.ItemID64) logOnError(err, "jobGStock : getObjItem") if err == nil { - totalSize += item.Weight * v.Quantity - switch item.ItemTypeID { - case objSubTypeItemResource: - resSize += item.Weight * v.Quantity - resCount += v.Quantity - case objSubTypeItemAlch: - alchSize += item.Weight * v.Quantity - alchCount += v.Quantity - case objSubTypeItemMisc: - miscSize += item.Weight * v.Quantity - miscCount += v.Quantity - case objSubTypeItemRecipe: - recSize += item.Weight * v.Quantity - recCount += v.Quantity - case objSubTypeItemPart: - partSize += item.Weight * v.Quantity - partCount += v.Quantity - case objSubTypeItemOther: - otherSize += item.Weight * v.Quantity - otherCount += v.Quantity + if item.Weight != -1 { + totalSize += item.Weight * v.Quantity + switch item.ItemTypeID { + case objSubTypeItemResource: + resSize += item.Weight * v.Quantity + resCount += v.Quantity + case objSubTypeItemAlch: + alchSize += item.Weight * v.Quantity + alchCount += v.Quantity + case objSubTypeItemMisc: + miscSize += item.Weight * v.Quantity + miscCount += v.Quantity + case objSubTypeItemRecipe: + recSize += item.Weight * v.Quantity + recCount += v.Quantity + case objSubTypeItemPart: + partSize += item.Weight * v.Quantity + partCount += v.Quantity + case objSubTypeItemOther: + otherSize += item.Weight * v.Quantity + otherCount += v.Quantity + } + } else { + w := TGCommand{ + Type: commandSendMsg, + Text: fmt.Sprintf("Unknown weight for item : %s - %s\n", item.Code, item.Name), + ToUserID64: cfg.Bot.Admin, + } + TGCmdQueue <- w } } } + txt := fmt.Sprintf("Current stock [%d/38000] :\n - Resources : %d (%d)\n - Alchemist : %d (%d)\n - Misc stuff : %d (%d)\n - Recipes : %d (%d)\n - Parts : %d (%d)\n - Other : %d (%d)\n", totalSize, resSize, resCount, alchSize, alchCount, miscSize, miscCount, recSize, recCount, partSize, partCount, otherSize, otherCount) m := TGCommand{