This commit is contained in:
shoopea 2020-01-16 15:37:15 +08:00
parent 80752d2225
commit 94437db65e
2 changed files with 14 additions and 6 deletions

View File

@ -86,5 +86,13 @@ func cronGetHammerTime() {
}
func cronSaveClients() {
var clts []ChirpClient
muxClients.RLock()
for _, c := range clients {
if c.Active {
clts = append(clts, c)
}
}
muxClients.RUnLock()
}

6
msg.go
View File

@ -354,11 +354,11 @@ func parseSubTypeMessageGRolesAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWa
func parseSubTypeMessageGoQuestAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageGoQuestAck, error) {
cwm := ChatWarsMessageGoQuestAck{}
/*
log.Printf("parseSubTypeMessageGoQuestAck : Go Quest Ack report identified\n")
log.Printf("parseSubTypeMessageGoQuestAck : Place : %s\n", r.ReplaceAllString(m.Text, "${Place}"))
log.Printf("parseSubTypeMessageGoQuestAck : Time : %s\n", r.ReplaceAllString(m.Text, "${Time}"))
*/
switch quest := strings.ToLower(r.ReplaceAllString(m.Text, "${Place}")); quest {
case "forest":
cwm.QuestTypeID64 = cacheObjSubType[`quest_forest`]
@ -369,7 +369,7 @@ func parseSubTypeMessageGoQuestAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatW
cwm.QuestTypeID64 = cacheObjSubType[`quest_forest`]
}
i, err := strconv.ParseInt(r.ReplaceAllString(m.Text, "${Time}"), 10, 64)
if err != nil {
if err == nil {
cwm.Duration = time.Duration(i) * time.Minute
} else {
cwm.Duration = 0 * time.Minute