This commit is contained in:
shoopea 2019-05-28 12:14:46 +08:00
parent f16d8524cc
commit 137dc3062c
3 changed files with 40 additions and 8 deletions

4
def.go
View File

@ -70,6 +70,10 @@ type ChatWarsMessageReportAck struct {
ObjID64 int64 `json:"obj_id"` ObjID64 int64 `json:"obj_id"`
} }
type ChatWarsMessageMeAck struct {
ObjID64 int64 `json:"obj_id"`
}
type ChatWarsMessageDuelFight struct { type ChatWarsMessageDuelFight struct {
ObjID64 int64 `json:"obj_id"` ObjID64 int64 `json:"obj_id"`
WinCastle string `json:"win_castle"` WinCastle string `json:"win_castle"`

24
msg.go
View File

@ -27,6 +27,30 @@ func parseSubTypeMessageReportAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWa
return &cwm, nil return &cwm, nil
} }
func parseSubTypeMessageMeAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageMeAck, error) {
cwm := ChatWarsMessageMeAck{}
log.Printf("parseSubTypeMessageReport : War report identified\n")
log.Printf("parseSubTypeMessageReport : Player : %s\n", r.ReplaceAllString(m.Text, "${Player}"))
log.Printf("parseSubTypeMessageReport : Castle : %s\n", r.ReplaceAllString(m.Text, "${Castle}"))
log.Printf("parseSubTypeMessageReport : Level : %s\n", r.ReplaceAllString(m.Text, "${Level}"))
log.Printf("parseSubTypeMessageReport : Atk : %s\n", r.ReplaceAllString(m.Text, "${Atk}"))
log.Printf("parseSubTypeMessageReport : Def : %s\n", r.ReplaceAllString(m.Text, "${Def}"))
log.Printf("parseSubTypeMessageReport : ExpNow : %s\n", r.ReplaceAllString(m.Text, "${ExpNow}"))
log.Printf("parseSubTypeMessageReport : ExpLvl : %s\n", r.ReplaceAllString(m.Text, "${ExpLvl}"))
log.Printf("parseSubTypeMessageReport : StaminaNow : %s\n", r.ReplaceAllString(m.Text, "${StaminaNow}"))
log.Printf("parseSubTypeMessageReport : StaminaMax : %s\n", r.ReplaceAllString(m.Text, "${StaminaMax}"))
log.Printf("parseSubTypeMessageReport : Gold : %s\n", r.ReplaceAllString(m.Text, "${Gold}"))
log.Printf("parseSubTypeMessageReport : Pogs : %s\n", r.ReplaceAllString(m.Text, "${Pogs}"))
log.Printf("parseSubTypeMessageReport : Gems : %s\n", r.ReplaceAllString(m.Text, "${Gems}"))
log.Printf("parseSubTypeMessageReport : AtkGear : %s\n", r.ReplaceAllString(m.Text, "${AtkGear}"))
log.Printf("parseSubTypeMessageReport : DefGear : %s\n", r.ReplaceAllString(m.Text, "${DefGear}"))
log.Printf("parseSubTypeMessageReport : BagUsed : %s\n", r.ReplaceAllString(m.Text, "${BagUsed}"))
log.Printf("parseSubTypeMessageReport : BagDispo : %s\n", r.ReplaceAllString(m.Text, "${BagDispo}"))
log.Printf("parseSubTypeMessageReport : State : %s\n", r.ReplaceAllString(m.Text, "${State}"))
return &cwm, nil
}
func parseSubTypeMessageUnionWar(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageUnionWar, error) { func parseSubTypeMessageUnionWar(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageUnionWar, error) {
//re := regexp.MustCompile('^(🏠Trade union news:\\n)(?P<Union>(?s:[^(🎪State of exclusive rights)]*))(🎪State of exclusive rights:)(?P<Fair>(?s:.*))$') //re := regexp.MustCompile('^(🏠Trade union news:\\n)(?P<Union>(?s:[^(🎪State of exclusive rights)]*))(🎪State of exclusive rights:)(?P<Fair>(?s:.*))$')

View File

@ -141,6 +141,9 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
err = setObjSubTypeId(objId, objSubTypeMessageMeReq) err = setObjSubTypeId(objId, objSubTypeMessageMeReq)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(MeReq)") logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(MeReq)")
case objSubTypeMessageMeAck: case objSubTypeMessageMeAck:
cwm, err := parseSubTypeMessageMeAck(m, r)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Parsing objSubTypeMessageMeAck.")
cwm.ObjID64 = objId
err = setObjSubTypeId(objId, objSubTypeMessageMeAck) err = setObjSubTypeId(objId, objSubTypeMessageMeAck)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(MeAck)") logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(MeAck)")
case objSubTypeMessageInventoryReq: case objSubTypeMessageInventoryReq:
@ -429,14 +432,15 @@ func MQKeepAliveWorker() {
Text: `🏅Me`, Text: `🏅Me`,
} }
MQTGCmdQueue <- c MQTGCmdQueue <- c
c = TGCommand{ /*
Type: commandSendMsg, c = TGCommand{
FromUserID64: x.UserID64, Type: commandSendMsg,
ToChatID64: userID64ChtWrsBot, FromUserID64: x.UserID64,
Text: `/hero`, ToChatID64: userID64ChtWrsBot,
} Text: `/hero`,
MQTGCmdQueue <- c }
MQTGCmdQueue <- c
*/
} }
} }
} }