test ambush

This commit is contained in:
shoopea 2019-10-20 20:24:52 +08:00
parent 0c52a28cb3
commit 749979b593

11
msg.go
View File

@ -432,15 +432,20 @@ func parseSubTypeMessageQuestResultAmbush(m *ChatWarsMessage, r *regexp.Regexp)
cwm := ChatWarsMessageQuestResultAmbush{} cwm := ChatWarsMessageQuestResultAmbush{}
re := regexp.MustCompile(`([0-9] x ){0,1}([a-zA-Z ]*) lvl\.([0-9]*)`) re := regexp.MustCompile(`([0-9]){0,1}( x ){0,1}([a-zA-Z ]*) lvl\.([0-9]*)`)
for _, l := range re.FindAllStringSubmatch(r.ReplaceAllString(m.Text, "${Monsters}"), -1) { for _, l := range re.FindAllStringSubmatch(r.ReplaceAllString(m.Text, "${Monsters}"), -1) {
log.Printf("parseSubTypeMessageQuestResultAmbush : %s\n", l[1]) log.Printf("parseSubTypeMessageQuestResultAmbush : %s\n", l[1])
log.Printf("parseSubTypeMessageQuestResultAmbush : %s\n", l[2]) log.Printf("parseSubTypeMessageQuestResultAmbush : %s\n", l[2])
log.Printf("parseSubTypeMessageQuestResultAmbush : %s\n", l[3]) log.Printf("parseSubTypeMessageQuestResultAmbush : %s\n", l[3])
lvl, _ := strconv.ParseInt(l[3], 10, 64) log.Printf("parseSubTypeMessageQuestResultAmbush : %s\n", l[4])
log.Printf("parseSubTypeMessageQuestResultAmbush : lvl : %d\n", lvl)
qty, _ := strconv.ParseInt(l[1], 10, 64) qty, _ := strconv.ParseInt(l[1], 10, 64)
log.Printf("parseSubTypeMessageQuestResultAmbush : qty : %d\n", qty) log.Printf("parseSubTypeMessageQuestResultAmbush : qty : %d\n", qty)
if qty == 0 {
qty = 1
}
lvl, _ := strconv.ParseInt(l[4], 10, 64)
log.Printf("parseSubTypeMessageQuestResultAmbush : lvl : %d\n", lvl)
level = level + float64(lvl*qty) level = level + float64(lvl*qty)
} }
cwm.Msg = m cwm.Msg = m