From 8e86ad3c6e353eacf8ffa21827b89eff12634571 Mon Sep 17 00:00:00 2001 From: shoopea Date: Mon, 27 Jan 2020 13:34:52 +0800 Subject: [PATCH] test --- job.go | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/job.go b/job.go index dcde154..14b78e1 100644 --- a/job.go +++ b/job.go @@ -1814,7 +1814,6 @@ func jobCraftItem(j Job) { totalMana = item.Craft.Mana * p.Quantity for _, v := range item.Craft.Items { - log.Printf("jobCraftItem[%s] : %s - %d\n", item.Code, v.Code, v.Quantity) requiredItems[v.Code] = v.Quantity * p.Quantity missingItems[v.Code] = 0 craftItems[v.Code] = 0 @@ -1852,33 +1851,36 @@ 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, code, req, ava, craft, missing) } /* we can finish the job */ - out := fmt.Sprintf("Summary for %s\n", item.Names[0]) - out = fmt.Sprintf("%s Mana : %d\n", out, totalMana) - out = fmt.Sprintf("%s
 Items :
\n", out) + out := fmt.Sprintf("Summary for %s\n", item.Names[0]) + out = fmt.Sprintf("%s Mana : %d\n", out, totalMana) + out = fmt.Sprintf("%s Items :\n", out) for k, v := range requiredItems { obj, _ := getObjItem(getObjItemID(k, ``)) ava, _ := availableItems[k] - out = fmt.Sprintf("%s [%s] %s : %d (%d)\n", out, obj.Code, obj.Names[0], v, ava) + out = fmt.Sprintf("%s [%s] %s : %d (%d)\n", out, obj.Code, obj.Names[0], v, ava) } - out = fmt.Sprintf("%s
 Missing :
\n", out) + out = fmt.Sprintf("%s Missing :\n", out) for k, v := range missingItems { - obj, _ := getObjItem(getObjItemID(k, ``)) - out = fmt.Sprintf("%s [%s] %s : %d\n", out, obj.Code, obj.Names[0], v) + if v > 0 { + obj, _ := getObjItem(getObjItemID(k, ``)) + out = fmt.Sprintf("%s [%s] %s : %d\n", out, obj.Code, obj.Names[0], v) + } } - out = fmt.Sprintf("%s
 To craft :
\n", out) + out = fmt.Sprintf("%s To craft :\n", out) for k, v := range craftItems { - obj, _ := getObjItem(getObjItemID(k, ``)) - out = fmt.Sprintf("%s [%s] %s : %d\n", out, obj.Code, obj.Names[0], v) + if v > 0 { + obj, _ := getObjItem(getObjItemID(k, ``)) + out = fmt.Sprintf("%s [%s] %s : %d\n", out, obj.Code, obj.Names[0], v) + } } + out = fmt.Sprintf("%s
", out) c := TGCommand{ Type: commandReplyMsg,