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)
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{