test
This commit is contained in:
parent
c4ac28ed64
commit
4cec05553c
@ -16,9 +16,7 @@ func clientSendCWMsg(userID64 int64, s string) {
|
||||
}
|
||||
|
||||
func clientMsgMeAck(m *ChatWarsMessageMeAck) {
|
||||
log.Printf("clientMsgMeAck %d\n", m.UserID64)
|
||||
if _, ok := clientsQueue[m.Msg.UserID64]; ok {
|
||||
log.Printf("Client in clientsQueue\n")
|
||||
if c, ok := clientsCW[m.UserID64]; ok {
|
||||
if c.LastUpdate.Before(m.Msg.Date) {
|
||||
c.GuildID64 = m.GuildID64
|
||||
@ -39,7 +37,5 @@ func clientMsgMeAck(m *ChatWarsMessageMeAck) {
|
||||
clientSendCWMsg(m.Msg.UserID64, "/g_roles")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.Printf("Client not in clientsQueue\n")
|
||||
}
|
||||
}
|
||||
|
10
def.go
10
def.go
@ -78,6 +78,14 @@ type ChatWarsMessageMeAck struct {
|
||||
State string `json:"state"`
|
||||
}
|
||||
|
||||
type parseSubTypeMessageGRolesAck struct {
|
||||
Msg *ChatWarsMessage `json:"msg"`
|
||||
BartenderID64 int64 `json:"bartender"`
|
||||
CommanderID64 int64 `json:"commander"`
|
||||
SquireID64 int64 `json:"squire"`
|
||||
TreasurerID64 int64 `json:"treasurer"`
|
||||
}
|
||||
|
||||
type ChatWarsMessageGoQuestAck struct {
|
||||
ObjID64 int64 `json:"obj_id"`
|
||||
}
|
||||
@ -273,6 +281,8 @@ const (
|
||||
objSubTypeMessageTUReportAck = 351 // result from /tu_report (not done)
|
||||
objSubTypeMessageTimeout = 352 // generic timeout for action
|
||||
objSubTypeMessageGoQuestAck = 353 // confirm quest destination/busyness (done)
|
||||
objSubTypeMessageGRolesReq = 354 // /g_roles (not done)
|
||||
objSubTypeMessageGRolesAck = 355 // result from /g_roles (not done)
|
||||
objSubTypeJobPillage = 601
|
||||
objSubTypeJobTribute = 602
|
||||
objSubTypeJobStatus = 603
|
||||
|
24
msg.go
24
msg.go
@ -56,11 +56,29 @@ func parseSubTypeMessageMeAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMe
|
||||
return &cwm, nil
|
||||
}
|
||||
|
||||
func parseSubTypeMessageGRolesAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageGRolesAck, error) {
|
||||
cwm := ChatWarsMessageGRolesAck{
|
||||
Msg: m,
|
||||
}
|
||||
/*
|
||||
BartenderID64: getObjUserID(r.ReplaceAllString(m.Text, "${Bartender}")),
|
||||
CommanderID64: getObjUserID(r.ReplaceAllString(m.Text, "${Commander}")),
|
||||
SquireID64: getObjUserID(r.ReplaceAllString(m.Text, "${Squire}")),
|
||||
TreasurerID64: getObjUserID(r.ReplaceAllString(m.Text, "${Treasurer}")),
|
||||
*/
|
||||
log.Printf("parseSubTypeMessageGRolesAck : Guild roles Ack identified\n")
|
||||
log.Printf("parseSubTypeMessageGRolesAck : Bartender : %s\n", r.ReplaceAllString(m.Text, "${Bartender}"))
|
||||
log.Printf("parseSubTypeMessageGRolesAck : Commander : %s\n", r.ReplaceAllString(m.Text, "${Commander}"))
|
||||
log.Printf("parseSubTypeMessageGRolesAck : Squire : %s\n", r.ReplaceAllString(m.Text, "${Squire}"))
|
||||
log.Printf("parseSubTypeMessageGRolesAck : Treasurer : %s\n", r.ReplaceAllString(m.Text, "${Treasurer}"))
|
||||
return &cwm, nil
|
||||
}
|
||||
|
||||
func parseSubTypeMessageGoQuestAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageGoQuestAck, error) {
|
||||
cwm := ChatWarsMessageGoQuestAck{}
|
||||
log.Printf("parseSubTypeMessageReport : Go Quest Ack report identified\n")
|
||||
log.Printf("parseSubTypeMessageReport : Place : %s\n", r.ReplaceAllString(m.Text, "${Place}"))
|
||||
log.Printf("parseSubTypeMessageReport : Time : %s\n", r.ReplaceAllString(m.Text, "${Time}"))
|
||||
log.Printf("parseSubTypeMessageGoQuestAck : Go Quest Ack report identified\n")
|
||||
log.Printf("parseSubTypeMessageGoQuestAck : Place : %s\n", r.ReplaceAllString(m.Text, "${Place}"))
|
||||
log.Printf("parseSubTypeMessageGoQuestAck : Time : %s\n", r.ReplaceAllString(m.Text, "${Time}"))
|
||||
return &cwm, nil
|
||||
}
|
||||
|
||||
|
2
rules.go
2
rules.go
@ -137,6 +137,8 @@ func resetMsgParsingRules() {
|
||||
,(5000, ` + strconv.Itoa(objSubTypeMessageGoQuestAck) + `, "Go Quest Ack Dead Marshes", "^You went to the (?P<Place>[a-zA-Z ]+). The dead are near. Back in (?P<Time>[0-9]+) minutes$")
|
||||
,(5000, ` + strconv.Itoa(objSubTypeMessageGoQuestAck) + `, "Go Quest Ack Mountain", "^(?P<Place>[a-zA-Z ']+) can be a dangerous place. You decided to investigate, what's going on. You'll be back in (?P<Time>[0-9]+) minutes.$")
|
||||
,(5000, ` + strconv.Itoa(objSubTypeMessageGoQuestAck) + `, "Go Quest Ack Devil's Valley", "^You went to the (?P<Place>[a-zA-Z ']+). Don't lose your soul. Back in (?P<Time>[0-9]+) minutes$")
|
||||
,(5000, ` + strconv.Itoa(objSubTypeMessageGRolesReq) + `, "Guild roles Req", "^/g_roles$")
|
||||
,(5000, ` + strconv.Itoa(objSubTypeMessageGRolesAck) + `, "Guild roles Req", "^Roles\\nBartender:\\n(?P<Bartender>.*)\\n\\n\nnCommander:\\n(?P<Commander>.*)\\n\\n\\nSquire:\\n(?P<Squire>.*)\\n\\n\\nTreasurer:\\n(?P<Treasurer>.*)$")
|
||||
;`)
|
||||
failOnError(err, "resetMsgParsingRules : populate table msg_rules")
|
||||
}
|
||||
|
2
sql.go
2
sql.go
@ -367,6 +367,8 @@ func initDB() {
|
||||
,(` + strconv.Itoa(objSubTypeMessageUnionWar) + `, "union_war", "Union war report", ` + strconv.Itoa(objTypeMessage) + `)
|
||||
,(` + strconv.Itoa(objSubTypeMessageTimeout) + `, "timeout", "Generic timeout", ` + strconv.Itoa(objTypeMessage) + `)
|
||||
,(` + strconv.Itoa(objSubTypeMessageGoQuestAck) + `, "go_quest_ack", "Go Quest Ack", ` + strconv.Itoa(objTypeMessage) + `)
|
||||
,(` + strconv.Itoa(objSubTypeMessageGRolesReq) + `, "groles_req", "Guild roles Req", ` + strconv.Itoa(objTypeMessage) + `)
|
||||
,(` + strconv.Itoa(objSubTypeMessageGRolesAck) + `, "groles_ack", "Guild roles Ack", ` + strconv.Itoa(objTypeMessage) + `)
|
||||
,(` + strconv.Itoa(objSubTypeJobPillage) + `, "job_pillage", "Pillage job", ` + strconv.Itoa(objTypeJob) + `)
|
||||
,(` + strconv.Itoa(objSubTypeJobTribute) + `, "job_tribute", "Tribute job", ` + strconv.Itoa(objTypeJob) + `)
|
||||
,(` + strconv.Itoa(objSubTypeJobWithdrawal) + `, "job_withdraw", "Withdrawal job", ` + strconv.Itoa(objTypeJob) + `)
|
||||
|
@ -235,6 +235,15 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
|
||||
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Parsing objSubTypeMessageUnionWar.")
|
||||
err = setObjSubTypeId(objId, objSubTypeMessageUnionWar)
|
||||
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(UnionWar)")
|
||||
case objSubTypeMessageGRolesReq:
|
||||
err = setObjSubTypeId(objId, objSubTypeMessageGRolesReq)
|
||||
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(GRolesReq)")
|
||||
case objSubTypeMessageGRolesAck:
|
||||
cwm, err := parseSubTypeMessageGRolesAck(m, r)
|
||||
cwm.Msg = m
|
||||
clientMsgMeAck(cwm)
|
||||
err = setObjSubTypeId(objId, objSubTypeMessageGRolesAck)
|
||||
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(GRolesAck)")
|
||||
case objSubTypeMessageAuctionAnnounce:
|
||||
cwm := ChatWarsMessageAuctionAnnounce{
|
||||
ObjID64: objId,
|
||||
|
Loading…
Reference in New Issue
Block a user