This commit is contained in:
shoopea 2019-05-20 20:29:11 +08:00
parent c6a2b2017d
commit 5a67b6b212
4 changed files with 61 additions and 1 deletions

5
def.go
View File

@ -207,6 +207,11 @@ const (
objSubTypeMessageSellReq = 337 // /wts_xx (done) objSubTypeMessageSellReq = 337 // /wts_xx (done)
objSubTypeMessageOrderbookReq = 338 // /t_xx (done) objSubTypeMessageOrderbookReq = 338 // /t_xx (done)
objSubTypeMessageOrderbookAck = 339 // orderbook summary (not done) objSubTypeMessageOrderbookAck = 339 // orderbook summary (not done)
objSubTypeMessageWithdrawReq = 340 // /g_withdraw (not done)
objSubTypeMessageWithdrawCode = 341 // code to receive (not done)
objSubTypeMessageWithdrawRcv = 342 // Received msg (not done)
objSubTypeMessageDepositReq = 343 // /g_deposit (not done)
objSubTypeMessageDepositAck = 344 // Deposited successfully (not done)
objSubTypeJobPillage = 601 objSubTypeJobPillage = 601
objSubTypeJobTribute = 602 objSubTypeJobTribute = 602
objSubTypeJobStatus = 603 objSubTypeJobStatus = 603

View File

@ -59,6 +59,37 @@ func resetMsgParsingRules() {
,(5000, ` + strconv.Itoa(objSubTypeMessageBuyReq) + `, "Buy request", "^/wtb_(?P<Item>[0-9]+)(_(?P<Quantity>[0-9]+)){0,1}$") ,(5000, ` + strconv.Itoa(objSubTypeMessageBuyReq) + `, "Buy request", "^/wtb_(?P<Item>[0-9]+)(_(?P<Quantity>[0-9]+)){0,1}$")
,(5000, ` + strconv.Itoa(objSubTypeMessageSellReq) + `, "Sell request", "^/wts_(?P<Item>[0-9]+)(_(?P<Quantity>[0-9]+)(_(?P<Price>[0-9]+)){0,1}){0,1}$") ,(5000, ` + strconv.Itoa(objSubTypeMessageSellReq) + `, "Sell request", "^/wts_(?P<Item>[0-9]+)(_(?P<Quantity>[0-9]+)(_(?P<Price>[0-9]+)){0,1}){0,1}$")
,(5000, ` + strconv.Itoa(objSubTypeMessageOrderbookReq) + `, "Orderbook request", "^/t_(?P<Item>[0-9]+)$") ,(5000, ` + strconv.Itoa(objSubTypeMessageOrderbookReq) + `, "Orderbook request", "^/t_(?P<Item>[0-9]+)$")
,(5000, ` + strconv.Itoa(objSubTypeMessageOrderbookAck) + `, "Orderbook request", "^$")
,(5000, ` + strconv.Itoa(objSubTypeMessageWithdrawReq) + `, "Withdraw Req", "^/g_withdraw( )+(?P<Item1>[a-z0-9]+)( )+(?P<Quantity1>[0-9]+)` +
`(( )+(?P<Item2>[a-z0-9]+)( )+(?P<Quantity2>[0-9]+)){0,1}` +
`(( )+(?P<Item3>[a-z0-9]+)( )+(?P<Quantity3>[0-9]+)){0,1}` +
`(( )+(?P<Item4>[a-z0-9]+)( )+(?P<Quantity4>[0-9]+)){0,1}` +
`(( )+(?P<Item5>[a-z0-9]+)( )+(?P<Quantity5>[0-9]+)){0,1}` +
`(( )+(?P<Item6>[a-z0-9]+)( )+(?P<Quantity6>[0-9]+)){0,1}` +
`(( )+(?P<Item7>[a-z0-9]+)( )+(?P<Quantity7>[0-9]+)){0,1}` +
`(( )+(?P<Item8>[a-z0-9]+)( )+(?P<Quantity8>[0-9]+)){0,1}$")
,(5000, ` + strconv.Itoa(objSubTypeMessageWithdrawCode) + `, "Withdraw Code", "^Withdrawing:\\n$` +
`(?P<Item1>.*) x (?P<Quantity1>.*)\\n` +
`((?P<Item2>.*) x (?P<Quantity2>.*)\\n){0,1}` +
`((?P<Item3>.*) x (?P<Quantity3>.*)\\n){0,1}` +
`((?P<Item4>.*) x (?P<Quantity4>.*)\\n){0,1}` +
`((?P<Item5>.*) x (?P<Quantity5>.*)\\n){0,1}` +
`((?P<Item6>.*) x (?P<Quantity6>.*)\\n){0,1}` +
`((?P<Item7>.*) x (?P<Quantity7>.*)\\n){0,1}` +
`((?P<Item8>.*) x (?P<Quantity8>.*)\\n){0,1}` +
`Recipient shall send to bot:\\n` +
`/g_receive [a-z0-9]+$")
,(5000, ` + strconv.Itoa(objSubTypeMessageWithdrawRcv) + `, "Withdraw Code", "^Received:\\n$` +
`(?P<Item1>.*) x (?P<Quantity1>.*)\\n` +
`((?P<Item2>.*) x (?P<Quantity2>.*)\\n){0,1}` +
`((?P<Item3>.*) x (?P<Quantity3>.*)\\n){0,1}` +
`((?P<Item4>.*) x (?P<Quantity4>.*)\\n){0,1}` +
`((?P<Item5>.*) x (?P<Quantity5>.*)\\n){0,1}` +
`((?P<Item6>.*) x (?P<Quantity6>.*)\\n){0,1}` +
`((?P<Item7>.*) x (?P<Quantity7>.*)\\n){0,1}` +
`((?P<Item8>.*) x (?P<Quantity8>.*)\\n){0,1}$")
,(5000, ` + strconv.Itoa(objSubTypeMessageDepositReq) + `, "Deposit Req", "^/g_deposit (?P<Item>[a-z0-9]+) (?P<Quantity>[0-9]+)$")
,(5000, ` + strconv.Itoa(objSubTypeMessageDepositAck) + `, "Deposit Ack", "^Deposited successfully: (?P<Item>.*) \\((?P<Quantity>[0-9]+)\\)$")
;`) ;`)
failOnError(err, "resetMsgParsingRules : populate table msg_rules") failOnError(err, "resetMsgParsingRules : populate table msg_rules")
} }

8
sql.go
View File

@ -358,7 +358,13 @@ func initDB() {
,(` + strconv.Itoa(objSubTypeMessageMenu) + `, "menu", "Menu", ` + strconv.Itoa(objTypeMessage) + `) ,(` + strconv.Itoa(objSubTypeMessageMenu) + `, "menu", "Menu", ` + strconv.Itoa(objTypeMessage) + `)
,(` + strconv.Itoa(objSubTypeMessageBuyReq) + `, "buy_req", "Sell Req", ` + strconv.Itoa(objTypeMessage) + `) ,(` + strconv.Itoa(objSubTypeMessageBuyReq) + `, "buy_req", "Sell Req", ` + strconv.Itoa(objTypeMessage) + `)
,(` + strconv.Itoa(objSubTypeMessageSellReq) + `, "sell_req", "Buy Req", ` + strconv.Itoa(objTypeMessage) + `) ,(` + strconv.Itoa(objSubTypeMessageSellReq) + `, "sell_req", "Buy Req", ` + strconv.Itoa(objTypeMessage) + `)
,(` + strconv.Itoa(objSubTypeMessageOrderbookReq) + `, "orderbook_req", "Buy Req", ` + strconv.Itoa(objTypeMessage) + `) ,(` + strconv.Itoa(objSubTypeMessageOrderbookReq) + `, "orderbook_req", "Orderbook Req", ` + strconv.Itoa(objTypeMessage) + `)
,(` + strconv.Itoa(objSubTypeMessageOrderbookAck) + `, "orderbook_acl", "Orderbook Ack", ` + strconv.Itoa(objTypeMessage) + `)
,(` + strconv.Itoa(objSubTypeMessageWithdrawReq) + `, "withdraw_req", "Withdraw Req", ` + strconv.Itoa(objTypeMessage) + `)
,(` + strconv.Itoa(objSubTypeMessageWithdrawCode) + `, "withdraw_code", "Withdraw Code", ` + strconv.Itoa(objTypeMessage) + `)
,(` + strconv.Itoa(objSubTypeMessageWithdrawRcv) + `, "withdraw_rcv", "Withdraw Received", ` + strconv.Itoa(objTypeMessage) + `)
,(` + strconv.Itoa(objSubTypeMessageDepositReq) + `, "deposit_req", "Deposit Req", ` + strconv.Itoa(objTypeMessage) + `)
,(` + strconv.Itoa(objSubTypeMessageDepositAck) + `, "deposit_ack", "Deposit 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) + `)

View File

@ -193,6 +193,24 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
case objSubTypeMessageOrderbookReq: case objSubTypeMessageOrderbookReq:
err = setObjSubTypeId(objId, objSubTypeMessageOrderbookReq) err = setObjSubTypeId(objId, objSubTypeMessageOrderbookReq)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(OrderbookReq)") logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(OrderbookReq)")
case objSubTypeMessageOrderbookAck:
err = setObjSubTypeId(objId, objSubTypeMessageSellReq)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(SellReq)")
case objSubTypeMessageWithdrawReq:
err = setObjSubTypeId(objId, objSubTypeMessageWithdrawReq)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(WithdrawReq)")
case objSubTypeMessageWithdrawCode:
err = setObjSubTypeId(objId, objSubTypeMessageWithdrawCode)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(WithdrawCode)")
case objSubTypeMessageWithdrawRcv:
err = setObjSubTypeId(objId, objSubTypeMessageWithdrawRcv)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(WithdrawRcv)")
case objSubTypeMessageDepositReq:
err = setObjSubTypeId(objId, objSubTypeMessageDepositReq)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(DepositReq)")
case objSubTypeMessageDepositAck:
err = setObjSubTypeId(objId, objSubTypeMessageDepositAck)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(DepositAck)")
case objSubTypeMessageAuctionAnnounce: case objSubTypeMessageAuctionAnnounce:
cwm := ChatWarsMessageAuctionAnnounce{ cwm := ChatWarsMessageAuctionAnnounce{
ObjID64: objId, ObjID64: objId,