From cb944c8a3600290d6bee81396fb881ec9d01ee72 Mon Sep 17 00:00:00 2001 From: shoopea Date: Fri, 14 Feb 2020 12:50:22 +0800 Subject: [PATCH] test new shop layout --- job.go | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/job.go b/job.go index 1130f6f..33cc529 100644 --- a/job.go +++ b/job.go @@ -2255,35 +2255,43 @@ func jobShops(j Job) { out = fmt.Sprintf("%s - %s\n", out, guru) } } + var ( + status string + username string + eta string + ) if cwm.Open { - out = fmt.Sprintf("%s ✅", out) + status = `✅` } else { - out = fmt.Sprintf("%s ⛔", out) + status = `⛔` } + c := getObjCastle(cwm.CastleID64) - out = fmt.Sprintf("%s%s", out, c.Logo) + for _, s := range cfg.Bot.Shops { if s.Link == cwm.Link { - out = fmt.Sprintf("%s@%s", out, s.Username) + username = s.Username break } } - out = fmt.Sprintf("%s [%4d💧]", out, cwm.Mana) - out = fmt.Sprintf("%s %s", out, cwm.Link, cwm.User) + eta = `` if cwm.Mana < cwm.ManaTotal { - out = fmt.Sprintf("%s ", out) t := (cwm.ManaTotal - cwm.Mana) / ((cwm.ManaTotal / 250) + 1) d := time.Duration(t) * time.Minute if d.Hours() > 1 { - out = fmt.Sprintf("%s%.0fh", out, d.Hours()) + eta = fmt.Sprintf("%s%.0fh", eta, d.Hours()) } d = d - d.Truncate(1*time.Hour) if d.Minutes() > 0 { - out = fmt.Sprintf("%s%.0fm", out, d.Minutes()) + eta = fmt.Sprintf("%s%.0fm", eta, d.Minutes()) } } - out = fmt.Sprintf("%s\n", out) + if eta == `` { + eta = "full" + } + + out = fmt.Sprintf("%s %s%s#%d [%d💧 %s] @%s\n", out, status, c.Logo, cwm.Link, cwm.ShopNumber, cwm.Mana, eta, username) } }