update gstock

This commit is contained in:
shoopea 2020-06-22 15:29:33 +02:00
parent 9703bb19b2
commit fa38da9749
2 changed files with 5 additions and 5 deletions

View File

@ -570,7 +570,7 @@
{ {
"prio": 5000, "prio": 5000,
"descn": "Guild stock any Ack", "descn": "Guild stock any Ack",
"rule": "^Guild Warehouse:(?P<Stock>(\\n[0-9a-z]+ (.*) x ([0-9]+))+)$", "rule": "^Guild Warehouse:(?P<Stock>(\\n[0-9a-z]+[ᵃᵇᶜᵈᵉ]{0,1} (.*) x ([0-9]+))+)$",
"msg_type": "msg_gstock_any_ack", "msg_type": "msg_gstock_any_ack",
"chat_id": 0, "chat_id": 0,
"user_id": 0 "user_id": 0

8
msg.go
View File

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