help with weightless item in g_stock

This commit is contained in:
shoopea 2019-12-14 13:18:20 +08:00
parent 67ab18d177
commit e917e6e47e

50
job.go
View File

@ -803,29 +803,39 @@ func jobGStock(j Job) {
item, err := getObjItem(v.ItemID64) item, err := getObjItem(v.ItemID64)
logOnError(err, "jobGStock : getObjItem") logOnError(err, "jobGStock : getObjItem")
if err == nil { if err == nil {
totalSize += item.Weight * v.Quantity if item.Weight != -1 {
switch item.ItemTypeID { totalSize += item.Weight * v.Quantity
case objSubTypeItemResource: switch item.ItemTypeID {
resSize += item.Weight * v.Quantity case objSubTypeItemResource:
resCount += v.Quantity resSize += item.Weight * v.Quantity
case objSubTypeItemAlch: resCount += v.Quantity
alchSize += item.Weight * v.Quantity case objSubTypeItemAlch:
alchCount += v.Quantity alchSize += item.Weight * v.Quantity
case objSubTypeItemMisc: alchCount += v.Quantity
miscSize += item.Weight * v.Quantity case objSubTypeItemMisc:
miscCount += v.Quantity miscSize += item.Weight * v.Quantity
case objSubTypeItemRecipe: miscCount += v.Quantity
recSize += item.Weight * v.Quantity case objSubTypeItemRecipe:
recCount += v.Quantity recSize += item.Weight * v.Quantity
case objSubTypeItemPart: recCount += v.Quantity
partSize += item.Weight * v.Quantity case objSubTypeItemPart:
partCount += v.Quantity partSize += item.Weight * v.Quantity
case objSubTypeItemOther: partCount += v.Quantity
otherSize += item.Weight * v.Quantity case objSubTypeItemOther:
otherCount += v.Quantity 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) 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{ m := TGCommand{