From f878f9aab982a1152d04162afeb756b797d3953a Mon Sep 17 00:00:00 2001 From: shoopea Date: Sat, 17 Oct 2020 16:13:19 +0200 Subject: [PATCH] test --- def.go | 12 ++++++++++++ msg.go | 18 ++++++++++++++++++ workers.go | 15 +++++++++------ 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/def.go b/def.go index 7f5e2bd..c58c0be 100644 --- a/def.go +++ b/def.go @@ -416,6 +416,18 @@ type ChatWarsMessageShopMainReq struct { Link string `json:"link"` } +type ChatWarsMessageGListAck struct { + Msg *ChatWarsMessage `json:"msg"` +} + +type ChatWarsMessageGDefListAck struct { + Msg *ChatWarsMessage `json:"msg"` +} + +type ChatWarsMessageGAtkListAck struct { + Msg *ChatWarsMessage `json:"msg"` +} + type ChatWarsMessageShopMainAck struct { Msg *ChatWarsMessage `json:"msg"` Name string `json:"name"` diff --git a/msg.go b/msg.go index d28cdba..3f7b74f 100644 --- a/msg.go +++ b/msg.go @@ -467,6 +467,24 @@ func parseSubTypeMessageShopMainAck(m *ChatWarsMessage, r *regexp.Regexp) (*Chat return &cwm, nil } +func parseSubTypeMessageGListAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageGListAck, error) { + cwm := ChatWarsMessageGListAck{} + cwm.Msg = m + return &cwm, nil +} + +func parseSubTypeMessageGDefListAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageGDefListAck, error) { + cwm := ChatWarsMessageGDefListAck{} + cwm.Msg = m + return &cwm, nil +} + +func parseSubTypeMessageGAtkListAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageGAtkListAck, error) { + cwm := ChatWarsMessageGAtkListAck{} + cwm.Msg = m + return &cwm, nil +} + func parseSubTypeMessageMeAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageMeAck, error) { var ( i int64 diff --git a/workers.go b/workers.go index 40df335..589053e 100644 --- a/workers.go +++ b/workers.go @@ -559,6 +559,15 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) { logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Parsing cacheObjSubType[`msg_shop_main_ack`]") err = insertMsgShopMainAck(cwm) logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : insertMsgShopMainAck") + case cacheObjSubType[`msg_g_list_req`]: + case cacheObjSubType[`msg_g_list_ack`]: + _, err := parseSubTypeMessageGListAck(m, rule.re) + case cacheObjSubType[`msg_g_atklist_req`]: + case cacheObjSubType[`msg_g_atklist_ack`]: + _, err := parseSubTypeMessageGAtkListAck(m, rule.re) + case cacheObjSubType[`msg_g_deflist_req`]: + case cacheObjSubType[`msg_g_deflist_ack`]: + _, err := parseSubTypeMessageGDefListAck(m, rule.re) case cacheObjSubType[`msg_bot_user_config`]: botUserConfig(m) case cacheObjSubType[`msg_bot_user_config_pillage_on`]: @@ -590,12 +599,6 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) { botVaultValOth(m) case cacheObjSubType[`msg_refresh_cmd`]: botRefreshMsg(m, rule.re) - case cacheObjSubType[`msg_g_list_req`]: - case cacheObjSubType[`msg_g_list_ack`]: - case cacheObjSubType[`msg_g_atklist_req`]: - case cacheObjSubType[`msg_g_atklist_ack`]: - case cacheObjSubType[`msg_g_deflist_req`]: - case cacheObjSubType[`msg_g_deflist_ack`]: default: //log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Unknwon message type in rule %d : %d (%d)\n%s\n", msgParsingRules[i].ID, msgParsingRules[i].MsgTypeID64, objId, m.Text) }