test alch all

This commit is contained in:
shoopea 2020-02-29 18:46:15 +08:00
parent c374507a89
commit 85c084bf1a

12
job.go
View File

@ -2035,6 +2035,7 @@ func jobAlchAll(j Job) {
maxManaItems map[int64]int64 maxManaItems map[int64]int64
maxResItems map[int64]int64 maxResItems map[int64]int64
itemInStock bool itemInStock bool
eta, out string
) )
err := setJobStart(j.ID64) err := setJobStart(j.ID64)
@ -2117,7 +2118,6 @@ func jobAlchAll(j Job) {
} }
} }
muxObjItem.RUnlock() muxObjItem.RUnlock()
var eta string
if p.ManaNow < p.ManaMax { if p.ManaNow < p.ManaMax {
t := (p.ManaMax - p.ManaNow) / ((p.ManaMax / 250) + 1) t := (p.ManaMax - p.ManaNow) / ((p.ManaMax / 250) + 1)
d := time.Duration(t) * time.Minute d := time.Duration(t) * time.Minute
@ -2128,11 +2128,19 @@ func jobAlchAll(j Job) {
if d.Minutes() > 0 { if d.Minutes() > 0 {
eta = fmt.Sprintf("%s%.0fm", eta, d.Minutes()) eta = fmt.Sprintf("%s%.0fm", eta, d.Minutes())
} }
} else {
eta = "0m"
}
for k, q := range maxManaItems {
if q == maxResItems[k] {
o, _ := getObjItem(k)
out = fmt.Sprintf("%s\n<code>%s - %s - %d</code>", out, o.Code, o.Name, q)
}
} }
c := TGCommand{ c := TGCommand{
Type: commandReplyMsg, Type: commandReplyMsg,
Text: "Success.", Text: fmt.Sprintf("ETA : %s\n%s", eta, out),
FromMsgID64: p.MsgID64, FromMsgID64: p.MsgID64,
FromChatID64: p.ChatID64, FromChatID64: p.ChatID64,
ParseMode: cmdParseModeHTML, ParseMode: cmdParseModeHTML,