This commit is contained in:
shoopea 2020-06-22 15:40:39 +02:00
parent 0a5c0dd358
commit 1761fe19c9

18
msg.go
View File

@ -325,9 +325,23 @@ func parseSubTypeMessageWithdrawRcv(m *ChatWarsMessage, r *regexp.Regexp) (*Chat
func parseSubTypeMessageGStockAnyAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageGStock, error) {
cwm := ChatWarsMessageGStock{}
stock := []ChatWarsItems{}
re := regexp.MustCompile(`\n([0-9a-z]+)([ᵃᵇᶜᵈᵉ]{0,1}) (.*) x ([0-9]+)`)
re := regexp.MustCompile(`\n([0-9a-z]+) (.*) x ([0-9]+)`)
for _, l := range re.FindAllStringSubmatch(r.ReplaceAllString(m.Text, "${Stock}"), -1) {
i := getObjItemID(l[1], l[3])
i := getObjItemID(l[1], l[2])
q, _ := strconv.ParseInt(l[3], 10, 64)
if i != 0 {
item := ChatWarsItems{
Code: l[1],
Name: l[2],
ItemID64: i,
Quantity: q,
}
stock = append(stock, item)
}
}
re = regexp.MustCompile(`\n(u[0-9]+)([ᵃᵇᶜᵈᵉ]{0,1}) (.*) x ([0-9]+)`)
for _, l := range re.FindAllStringSubmatch(r.ReplaceAllString(m.Text, "${Stock}"), -1) {
i := getObjItemID(``, l[3])
q, _ := strconv.ParseInt(l[4], 10, 64)
if i != 0 {
item := ChatWarsItems{