This commit is contained in:
shoopea 2020-02-09 16:32:47 +08:00
parent 5637aa7a0d
commit 3cabcae6a9

6
msg.go
View File

@ -175,7 +175,6 @@ func parseSubTypeMessageStockAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWar
func parseSubTypeMessageReportAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageReportAck, error) { func parseSubTypeMessageReportAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageReportAck, error) {
cwm := ChatWarsMessageReportAck{} cwm := ChatWarsMessageReportAck{}
// log.Printf("parseSubTypeMessageReport : Extra : %s\n", r.ReplaceAllString(m.Text, "${Extra}"))
re := regexp.MustCompile(`(` + re := regexp.MustCompile(`(` +
`(?P<Cry>Your battle cries were successful)|` + `(?P<Cry>Your battle cries were successful)|` +
`(You were outplayed by (?P<Outplayer>.*))|` + `(You were outplayed by (?P<Outplayer>.*))|` +
@ -187,6 +186,7 @@ func parseSubTypeMessageReportAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWa
`(You were healed by (?P<Healer>.*))|` + `(You were healed by (?P<Healer>.*))|` +
`(You were poisoned by (?P<Poisoner>.*))|` + `(You were poisoned by (?P<Poisoner>.*))|` +
`(Got hit by an arrow from (?P<Archer>.*), (?P<Skill>.*) skill decreased)|` + `(Got hit by an arrow from (?P<Archer>.*), (?P<Skill>.*) skill decreased)|` +
`(Your (?P<Broken>.*) has been broken)|` +
`.+)`) `.+)`)
for i, l := range re.FindAllStringSubmatch(r.ReplaceAllString(m.Text, "${Extra}"), -1) { for i, l := range re.FindAllStringSubmatch(r.ReplaceAllString(m.Text, "${Extra}"), -1) {
if len(re.ReplaceAllString(l[0], "${Cry}")) != 0 { if len(re.ReplaceAllString(l[0], "${Cry}")) != 0 {
@ -208,7 +208,9 @@ func parseSubTypeMessageReportAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWa
} else if len(re.ReplaceAllString(l[0], "${Poisoner}")) != 0 { } else if len(re.ReplaceAllString(l[0], "${Poisoner}")) != 0 {
// log.Printf("parseSubTypeMessageReport : Extra[%d] : Poisoner : %s\n", i, re.ReplaceAllString(l[0], "${Poisoner}")) // log.Printf("parseSubTypeMessageReport : Extra[%d] : Poisoner : %s\n", i, re.ReplaceAllString(l[0], "${Poisoner}"))
} else if len(re.ReplaceAllString(l[0], "${Archer}")) != 0 && len(re.ReplaceAllString(l[0], "${Skill}")) != 0 { } else if len(re.ReplaceAllString(l[0], "${Archer}")) != 0 && len(re.ReplaceAllString(l[0], "${Skill}")) != 0 {
log.Printf("parseSubTypeMessageReport : Extra[%d] : Archer : %s / Skill : %s\n", i, re.ReplaceAllString(l[0], "${Archer}"), re.ReplaceAllString(l[0], "${Skill}")) // log.Printf("parseSubTypeMessageReport : Extra[%d] : Archer : %s / Skill : %s\n", i, re.ReplaceAllString(l[0], "${Archer}"), re.ReplaceAllString(l[0], "${Skill}"))
} else if len(re.ReplaceAllString(l[0], "${Broken}")) != 0 {
// log.Printf("parseSubTypeMessageReport : Extra[%d] : Broken\n", i)
} else { } else {
log.Printf("parseSubTypeMessageReport : Extra[%d] : %s\n", i, l[0]) log.Printf("parseSubTypeMessageReport : Extra[%d] : %s\n", i, l[0])
} }