test
This commit is contained in:
parent
25df2a3674
commit
a40c174985
9
def.go
9
def.go
@ -74,6 +74,10 @@ type ChatWarsMessageMeAck struct {
|
|||||||
ObjID64 int64 `json:"obj_id"`
|
ObjID64 int64 `json:"obj_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ChatWarsMessageGoQuestAck 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"`
|
||||||
@ -219,7 +223,7 @@ const (
|
|||||||
objSubTypeMessageHeroReq = 311 // /hero (done)
|
objSubTypeMessageHeroReq = 311 // /hero (done)
|
||||||
objSubTypeMessageHeroAck = 312 // result from /hero (not done)
|
objSubTypeMessageHeroAck = 312 // result from /hero (not done)
|
||||||
objSubTypeMessageMeReq = 313 // 🏅Me (done)
|
objSubTypeMessageMeReq = 313 // 🏅Me (done)
|
||||||
objSubTypeMessageMeAck = 314 // result from 🏅Me (not done)
|
objSubTypeMessageMeAck = 314 // result from 🏅Me (done)
|
||||||
objSubTypeMessageInventoryReq = 315 // /inv (done)
|
objSubTypeMessageInventoryReq = 315 // /inv (done)
|
||||||
objSubTypeMessageInventoryAck = 316 // result from /inv (not done)
|
objSubTypeMessageInventoryAck = 316 // result from /inv (not done)
|
||||||
objSubTypeMessagePillageInc = 317 // random incoming pillage (done)
|
objSubTypeMessagePillageInc = 317 // random incoming pillage (done)
|
||||||
@ -247,7 +251,7 @@ const (
|
|||||||
objSubTypeMessageOrderbookAck = 339 // orderbook summary (not done)
|
objSubTypeMessageOrderbookAck = 339 // orderbook summary (not done)
|
||||||
objSubTypeMessageWithdrawReq = 340 // /g_withdraw (done)
|
objSubTypeMessageWithdrawReq = 340 // /g_withdraw (done)
|
||||||
objSubTypeMessageWithdrawCode = 341 // code to receive (done)
|
objSubTypeMessageWithdrawCode = 341 // code to receive (done)
|
||||||
objSubTypeMessageWithdrawRcv = 342 // Received msg (done)
|
objSubTypeMessageWithdrawRcv = 342 // Withdraw "received" msg (done)
|
||||||
objSubTypeMessageDepositReq = 343 // /g_deposit (done)
|
objSubTypeMessageDepositReq = 343 // /g_deposit (done)
|
||||||
objSubTypeMessageDepositAck = 344 // Deposited successfully (done)
|
objSubTypeMessageDepositAck = 344 // Deposited successfully (done)
|
||||||
objSubTypeMessageStockReq = 345 // /stock (done)
|
objSubTypeMessageStockReq = 345 // /stock (done)
|
||||||
@ -258,6 +262,7 @@ const (
|
|||||||
objSubTypeMessageTUReportReq = 350 // /tu_report (not done)
|
objSubTypeMessageTUReportReq = 350 // /tu_report (not done)
|
||||||
objSubTypeMessageTUReportAck = 351 // result from /tu_report (not done)
|
objSubTypeMessageTUReportAck = 351 // result from /tu_report (not done)
|
||||||
objSubTypeMessageTimeout = 352 // generic timeout for action
|
objSubTypeMessageTimeout = 352 // generic timeout for action
|
||||||
|
objSubTypeMessageGoQuestAck = 353 // confirm quest destination/busyness (done)
|
||||||
objSubTypeJobPillage = 601
|
objSubTypeJobPillage = 601
|
||||||
objSubTypeJobTribute = 602
|
objSubTypeJobTribute = 602
|
||||||
objSubTypeJobStatus = 603
|
objSubTypeJobStatus = 603
|
||||||
|
68
msg.go
68
msg.go
@ -29,27 +29,55 @@ func parseSubTypeMessageReportAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWa
|
|||||||
|
|
||||||
func parseSubTypeMessageMeAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageMeAck, error) {
|
func parseSubTypeMessageMeAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageMeAck, error) {
|
||||||
cwm := ChatWarsMessageMeAck{}
|
cwm := ChatWarsMessageMeAck{}
|
||||||
log.Printf("parseSubTypeMessageReport : Me report identified\n")
|
/*
|
||||||
log.Printf("parseSubTypeMessageReport : Player : %s\n", r.ReplaceAllString(m.Text, "${Player}"))
|
log.Printf("parseSubTypeMessageReport : Me report identified\n")
|
||||||
log.Printf("parseSubTypeMessageReport : Guild : %s\n", r.ReplaceAllString(m.Text, "${Guild}"))
|
log.Printf("parseSubTypeMessageReport : Player : %s\n", r.ReplaceAllString(m.Text, "${Player}"))
|
||||||
log.Printf("parseSubTypeMessageReport : Class : %s\n", r.ReplaceAllString(m.Text, "${Class}"))
|
log.Printf("parseSubTypeMessageReport : Guild : %s\n", r.ReplaceAllString(m.Text, "${Guild}"))
|
||||||
log.Printf("parseSubTypeMessageReport : Castle : %s\n", r.ReplaceAllString(m.Text, "${Castle}"))
|
log.Printf("parseSubTypeMessageReport : Class : %s\n", r.ReplaceAllString(m.Text, "${Class}"))
|
||||||
log.Printf("parseSubTypeMessageReport : Level : %s\n", r.ReplaceAllString(m.Text, "${Level}"))
|
log.Printf("parseSubTypeMessageReport : Castle : %s\n", r.ReplaceAllString(m.Text, "${Castle}"))
|
||||||
log.Printf("parseSubTypeMessageReport : Atk : %s\n", r.ReplaceAllString(m.Text, "${Atk}"))
|
log.Printf("parseSubTypeMessageReport : Level : %s\n", r.ReplaceAllString(m.Text, "${Level}"))
|
||||||
log.Printf("parseSubTypeMessageReport : Def : %s\n", r.ReplaceAllString(m.Text, "${Def}"))
|
log.Printf("parseSubTypeMessageReport : Atk : %s\n", r.ReplaceAllString(m.Text, "${Atk}"))
|
||||||
log.Printf("parseSubTypeMessageReport : ExpNow : %s\n", r.ReplaceAllString(m.Text, "${ExpNow}"))
|
log.Printf("parseSubTypeMessageReport : Def : %s\n", r.ReplaceAllString(m.Text, "${Def}"))
|
||||||
log.Printf("parseSubTypeMessageReport : ExpLvl : %s\n", r.ReplaceAllString(m.Text, "${ExpLvl}"))
|
log.Printf("parseSubTypeMessageReport : ExpNow : %s\n", r.ReplaceAllString(m.Text, "${ExpNow}"))
|
||||||
log.Printf("parseSubTypeMessageReport : StaminaNow : %s\n", r.ReplaceAllString(m.Text, "${StaminaNow}"))
|
log.Printf("parseSubTypeMessageReport : ExpLvl : %s\n", r.ReplaceAllString(m.Text, "${ExpLvl}"))
|
||||||
log.Printf("parseSubTypeMessageReport : StaminaMax : %s\n", r.ReplaceAllString(m.Text, "${StaminaMax}"))
|
log.Printf("parseSubTypeMessageReport : StaminaNow : %s\n", r.ReplaceAllString(m.Text, "${StaminaNow}"))
|
||||||
log.Printf("parseSubTypeMessageReport : Gold : %s\n", r.ReplaceAllString(m.Text, "${Gold}"))
|
log.Printf("parseSubTypeMessageReport : StaminaMax : %s\n", r.ReplaceAllString(m.Text, "${StaminaMax}"))
|
||||||
log.Printf("parseSubTypeMessageReport : Pogs : %s\n", r.ReplaceAllString(m.Text, "${Pogs}"))
|
log.Printf("parseSubTypeMessageReport : Gold : %s\n", r.ReplaceAllString(m.Text, "${Gold}"))
|
||||||
log.Printf("parseSubTypeMessageReport : Gems : %s\n", r.ReplaceAllString(m.Text, "${Gems}"))
|
log.Printf("parseSubTypeMessageReport : Pogs : %s\n", r.ReplaceAllString(m.Text, "${Pogs}"))
|
||||||
log.Printf("parseSubTypeMessageReport : AtkGear : %s\n", r.ReplaceAllString(m.Text, "${AtkGear}"))
|
log.Printf("parseSubTypeMessageReport : Gems : %s\n", r.ReplaceAllString(m.Text, "${Gems}"))
|
||||||
log.Printf("parseSubTypeMessageReport : DefGear : %s\n", r.ReplaceAllString(m.Text, "${DefGear}"))
|
log.Printf("parseSubTypeMessageReport : AtkGear : %s\n", r.ReplaceAllString(m.Text, "${AtkGear}"))
|
||||||
log.Printf("parseSubTypeMessageReport : BagUsed : %s\n", r.ReplaceAllString(m.Text, "${BagUsed}"))
|
log.Printf("parseSubTypeMessageReport : DefGear : %s\n", r.ReplaceAllString(m.Text, "${DefGear}"))
|
||||||
log.Printf("parseSubTypeMessageReport : BagDispo : %s\n", r.ReplaceAllString(m.Text, "${BagDispo}"))
|
log.Printf("parseSubTypeMessageReport : BagUsed : %s\n", r.ReplaceAllString(m.Text, "${BagUsed}"))
|
||||||
log.Printf("parseSubTypeMessageReport : State : %s\n", r.ReplaceAllString(m.Text, "${State}"))
|
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 parseSubTypeMessageGoQuestAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageGoQuestAck, error) {
|
||||||
|
cwm := ChatWarsMessageGoQuestAck{}
|
||||||
|
/*
|
||||||
|
log.Printf("parseSubTypeMessageReport : Me report identified\n")
|
||||||
|
log.Printf("parseSubTypeMessageReport : Player : %s\n", r.ReplaceAllString(m.Text, "${Player}"))
|
||||||
|
log.Printf("parseSubTypeMessageReport : Guild : %s\n", r.ReplaceAllString(m.Text, "${Guild}"))
|
||||||
|
log.Printf("parseSubTypeMessageReport : Class : %s\n", r.ReplaceAllString(m.Text, "${Class}"))
|
||||||
|
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
|
return &cwm, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
9
rules.go
9
rules.go
@ -119,7 +119,7 @@ func resetMsgParsingRules() {
|
|||||||
,(4900, ` + strconv.Itoa(objSubTypeMessageUnionWar) + `, "Union war rep only union", "^(🏠Trade union news:\n)(?P<Union>(?s:.*))(🎪State of exclusive rights:\n){0}(?P<Fair>(?s:.*))$")
|
,(4900, ` + strconv.Itoa(objSubTypeMessageUnionWar) + `, "Union war rep only union", "^(🏠Trade union news:\n)(?P<Union>(?s:.*))(🎪State of exclusive rights:\n){0}(?P<Fair>(?s:.*))$")
|
||||||
,(4900, ` + strconv.Itoa(objSubTypeMessageUnionWar) + `, "Union war rep only fair", "^(🏠Trade union news:\n){0}(?P<Union>(?s:.*))(🎪State of exclusive rights:\n)(?P<Fair>(?s:.*))$")
|
,(4900, ` + strconv.Itoa(objSubTypeMessageUnionWar) + `, "Union war rep only fair", "^(🏠Trade union news:\n){0}(?P<Union>(?s:.*))(🎪State of exclusive rights:\n)(?P<Fair>(?s:.*))$")
|
||||||
,(5000, ` + strconv.Itoa(objSubTypeMessageTimeout) + `, "Generic timeout", "^Too late. Action is not available.$")
|
,(5000, ` + strconv.Itoa(objSubTypeMessageTimeout) + `, "Generic timeout", "^Too late. Action is not available.$")
|
||||||
,(5000, ` + strconv.Itoa(objSubTypeMessageMeAck) + `, "Me ack", "^(?s:.*)Battle of the seven castles in .*!\\n(?s:.*)\\n` +
|
,(5000, ` + strconv.Itoa(objSubTypeMessageMeAck) + `, "Me ack", "^(?s:.*)Battle(.*)of the seven castles in .*!\\n(?s:.*)\\n` +
|
||||||
`(?P<CastleIcon>.)(\\[(?P<Guild>[A-Z0-9]+)\\]){0,1}(?P<Player>.*?) ((?P<Class>(Knight|Ranger|Sentinel|Collector|Blacksmith|Alchemist)) ){0,1}of (?P<Castle>[a-zA-Z]*) Castle\\n` +
|
`(?P<CastleIcon>.)(\\[(?P<Guild>[A-Z0-9]+)\\]){0,1}(?P<Player>.*?) ((?P<Class>(Knight|Ranger|Sentinel|Collector|Blacksmith|Alchemist)) ){0,1}of (?P<Castle>[a-zA-Z]*) Castle\\n` +
|
||||||
`.Level: (?P<Level>[0-9]+)\\n` +
|
`.Level: (?P<Level>[0-9]+)\\n` +
|
||||||
`.Atk: (?P<Atk>[0-9]+) .Def: (?P<Def>[0-9]+)\\n` +
|
`.Atk: (?P<Atk>[0-9]+) .Def: (?P<Def>[0-9]+)\\n` +
|
||||||
@ -130,6 +130,13 @@ func resetMsgParsingRules() {
|
|||||||
`🎒Bag: (?P<BagUsed>[0-9]+)/(?P<BagDispo>[0-9]+) /inv\\n\\n` +
|
`🎒Bag: (?P<BagUsed>[0-9]+)/(?P<BagDispo>[0-9]+) /inv\\n\\n` +
|
||||||
`State:\\n(?P<State>.*)\\n\\n` +
|
`State:\\n(?P<State>.*)\\n\\n` +
|
||||||
`More: /hero(?s:.*)$")
|
`More: /hero(?s:.*)$")
|
||||||
|
,(5000, ` + strconv.Itoa(objSubTypeMessageGoQuestAck) + `, "Go Quest Ack Forest", "^In a dire need for an adventure, you went to a (?P<Place>[a-zA-Z]+). You'll be back in (?P<Time>[0-9]+) minutes.$")
|
||||||
|
,(5000, ` + strconv.Itoa(objSubTypeMessageGoQuestAck) + `, "Go Quest Ack Mirkwood", "^You went to the (?P<Place>[a-zA-Z]+). Beware of spooders. Back in (?P<Time>[0-9]+) minutes$")
|
||||||
|
,(5000, ` + strconv.Itoa(objSubTypeMessageGoQuestAck) + `, "Go Quest Ack Village", "^Feeling an unsatisfiable lust for violence you set off to the nearest village. You will reach the nearest one in 2 minutes$")
|
||||||
|
,(5000, ` + strconv.Itoa(objSubTypeMessageGoQuestAck) + `, "Go Quest Ack Swamp", "^An adventure is calling. But you went to a swamp. You''ll be back in 6 minutes.$")
|
||||||
|
,(5000, ` + strconv.Itoa(objSubTypeMessageGoQuestAck) + `, "Go Quest Ack Dead Marshes", "^You went to the Dead Marshes. The dead are near. Back in 8 minutes$")
|
||||||
|
,(5000, ` + strconv.Itoa(objSubTypeMessageGoQuestAck) + `, "Go Quest Ack Mountain", "^Mountains can be a dangerous place. You decided to investigate, what''s going on. You''ll be back in 8 minutes.$")
|
||||||
|
,(5000, ` + strconv.Itoa(objSubTypeMessageGoQuestAck) + `, "Go Quest Ack Mountain", "^You went to the Devil''s Valley. Don''t lose your soul. Back in 6 minutes$")
|
||||||
;`)
|
;`)
|
||||||
failOnError(err, "resetMsgParsingRules : populate table msg_rules")
|
failOnError(err, "resetMsgParsingRules : populate table msg_rules")
|
||||||
}
|
}
|
||||||
|
1
sql.go
1
sql.go
@ -366,6 +366,7 @@ func initDB() {
|
|||||||
,(` + strconv.Itoa(objSubTypeMessageTUReportAck) + `, "tureport_ack", "Trade Union War Report Ack", ` + strconv.Itoa(objTypeMessage) + `)
|
,(` + strconv.Itoa(objSubTypeMessageTUReportAck) + `, "tureport_ack", "Trade Union War Report Ack", ` + strconv.Itoa(objTypeMessage) + `)
|
||||||
,(` + strconv.Itoa(objSubTypeMessageUnionWar) + `, "union_war", "Union war report", ` + strconv.Itoa(objTypeMessage) + `)
|
,(` + strconv.Itoa(objSubTypeMessageUnionWar) + `, "union_war", "Union war report", ` + strconv.Itoa(objTypeMessage) + `)
|
||||||
,(` + strconv.Itoa(objSubTypeMessageTimeout) + `, "timeout", "Generic timeout", ` + 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(objSubTypeJobPillage) + `, "job_pillage", "Pillage job", ` + strconv.Itoa(objTypeJob) + `)
|
,(` + strconv.Itoa(objSubTypeJobPillage) + `, "job_pillage", "Pillage job", ` + strconv.Itoa(objTypeJob) + `)
|
||||||
,(` + strconv.Itoa(objSubTypeJobTribute) + `, "job_tribute", "Tribute job", ` + strconv.Itoa(objTypeJob) + `)
|
,(` + strconv.Itoa(objSubTypeJobTribute) + `, "job_tribute", "Tribute job", ` + strconv.Itoa(objTypeJob) + `)
|
||||||
,(` + strconv.Itoa(objSubTypeJobWithdrawal) + `, "job_withdraw", "Withdrawal job", ` + strconv.Itoa(objTypeJob) + `)
|
,(` + strconv.Itoa(objSubTypeJobWithdrawal) + `, "job_withdraw", "Withdrawal job", ` + strconv.Itoa(objTypeJob) + `)
|
||||||
|
@ -146,6 +146,12 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
|
|||||||
cwm.ObjID64 = objId
|
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 objSubTypeMessageGoQuestAck:
|
||||||
|
cwm, err := parseSubTypeMessageGoQuestAck(m, r)
|
||||||
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Parsing objSubTypeMessageMeAck.")
|
||||||
|
cwm.ObjID64 = objId
|
||||||
|
err = setObjSubTypeId(objId, objSubTypeMessageGoQuestAck)
|
||||||
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(GoQuestAck)")
|
||||||
case objSubTypeMessageInventoryReq:
|
case objSubTypeMessageInventoryReq:
|
||||||
err = setObjSubTypeId(objId, objSubTypeMessageInventoryReq)
|
err = setObjSubTypeId(objId, objSubTypeMessageInventoryReq)
|
||||||
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(InventoryReq)")
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(InventoryReq)")
|
||||||
|
Loading…
Reference in New Issue
Block a user