test
This commit is contained in:
parent
5ef14e6c05
commit
bb522e9fcd
62
def.go
62
def.go
@ -159,34 +159,40 @@ const (
|
|||||||
castleWolf = 7
|
castleWolf = 7
|
||||||
|
|
||||||
objSubTypeMessageUnknown = 301
|
objSubTypeMessageUnknown = 301
|
||||||
objSubTypeMessageWar = 302
|
objSubTypeMessageWar = 302 // from Chat Wars Reports (not done)
|
||||||
objSubTypeMessageMiniWar = 303
|
objSubTypeMessageMiniWar = 303 // from Chat Wars Mini Reports (done)
|
||||||
objSubTypeMessageGuildWar = 304
|
objSubTypeMessageGuildWar = 304 // from Chat Wars Reports (not done)
|
||||||
objSubTypeMessageReport = 305
|
objSubTypeMessageReportReq = 305 // /report (done)
|
||||||
objSubTypeMessageGReport = 306
|
objSubTypeMessageReportAck = 306 // result from /report (not done)
|
||||||
objSubTypeMessageQuest = 307
|
objSubTypeMessageGReportReq = 307 // /g_report (done)
|
||||||
objSubTypeMessageDuelFight = 308
|
objSubTypeMessageGReportAck = 308 // result from /g_report (not done)
|
||||||
objSubTypeMessageHero = 309
|
objSubTypeMessageQuestResult = 309 // result from going to quest (not done)
|
||||||
objSubTypeMessageMe = 310
|
objSubTypeMessageDuelFight = 310 // result from going to duel fight (done)
|
||||||
objSubTypeMessageInventory = 311
|
objSubTypeMessageHeroReq = 311 // /hero (done)
|
||||||
objSubTypeMessagePillageInc = 312
|
objSubTypeMessageHeroAck = 312 // result from /hero (not done)
|
||||||
objSubTypeMessagePillageGo = 313
|
objSubTypeMessageMeReq = 313 // 🏅Me (done)
|
||||||
objSubTypeMessagePillageTimeout = 314
|
objSubTypeMessageMeAck = 314 // result from 🏅Me (not done)
|
||||||
objSubTypeMessagePillageWin = 315
|
objSubTypeMessageInventoryReq = 315 // /inv (done)
|
||||||
objSubTypeMessagePillageLoss = 316
|
objSubTypeMessageInventoryAck = 316 // result from /inv (not done)
|
||||||
objSubTypeMessageTributeInc = 317
|
objSubTypeMessagePillageInc = 317 // random incoming pillage (done)
|
||||||
objSubTypeMessageTributeAck = 318
|
objSubTypeMessagePillageGo = 318 // ack from /go (done)
|
||||||
objSubTypeMessageAuctionAnnounce = 319
|
objSubTypeMessagePillageTimeout = 319 // ack from lack of /go (done)
|
||||||
objSubTypeMessageAuctionUpdReq = 320
|
objSubTypeMessagePillageWin = 320 // pillage successfully intercepted (done)
|
||||||
objSubTypeMessageAuctionUpdAck = 321
|
objSubTypeMessagePillageLoss = 321 // pillage not intercepted (done)
|
||||||
objSubTypeMessageTimeAck = 322
|
objSubTypeMessageTributeInc = 322 // request for a /pledge (not done)
|
||||||
objSubTypeMessageTimeReq = 323
|
objSubTypeMessageTributeAck = 323 // pledge accepted (not done)
|
||||||
objSubTypeMessageGo = 324
|
objSubTypeMessageAuctionAnnounce = 324 // from Boris and Co, Ltd (done)
|
||||||
objSubTypeMessageGoQuest = 325
|
objSubTypeMessageAuctionUpdReq = 325 // /l_123456 msg (not done)
|
||||||
objSubTypeMessageGoArena = 326
|
objSubTypeMessageAuctionUpdAck = 326 // result from /l_123456 (not done)
|
||||||
objSubTypeMessageArena = 327
|
objSubTypeMessageTimeAck = 327 // result from /time (done)
|
||||||
objSubTypeMessageTop = 328
|
objSubTypeMessageTimeReq = 328 // /time (done)
|
||||||
objSubTypeMessageMenu = 329
|
objSubTypeMessageGo = 329 // /go (done)
|
||||||
|
objSubTypeMessagePledge = 330 // /pledge (done)
|
||||||
|
objSubTypeMessageGoQuest = 331 // 🌲Forest or 🍄Swamp or ⛰️Valley (not done)
|
||||||
|
objSubTypeMessageGoFastFight = 332 // ▶️Fast fight (not done)
|
||||||
|
objSubTypeMessageGoArena = 333 // 📯Arena (not done)
|
||||||
|
objSubTypeMessageTop = 334
|
||||||
|
objSubTypeMessageMenu = 335
|
||||||
objSubTypeJobPillage = 601
|
objSubTypeJobPillage = 601
|
||||||
objSubTypeJobTribute = 602
|
objSubTypeJobTribute = 602
|
||||||
objSubTypeJobStatus = 603
|
objSubTypeJobStatus = 603
|
||||||
|
49
sql.go
49
sql.go
@ -1304,55 +1304,6 @@ INSERT INTO obj_item (obj_id, intl_id, name, weight) VALUES
|
|||||||
log.Println("initDB : Database set up")
|
log.Println("initDB : Database set up")
|
||||||
}
|
}
|
||||||
|
|
||||||
func resetMsgParsingRules() {
|
|
||||||
_, err := db.Exec(`TRUNCATE TABLE msg_rules;`)
|
|
||||||
failOnError(err, "resetMsgParsingRules : truncate table msg_rules")
|
|
||||||
|
|
||||||
_, err = db.Exec(`INSERT INTO msg_rules (prio, msg_type_id, descn, rule)
|
|
||||||
VALUES (5000, ` + strconv.Itoa(objSubTypeMessageReport) + `, "Player war report", "^(?P<Castle>[🐉🦅🐺🦈🦌🥔🌑])(\\[(?P<Guild>[A-Z0-9]{1,3})\\]){0,1}(?P<User>([A-Za-z0-9 ]*)) ⚔:(?P<Attack>[0-9]+)(?P<AttackMod>\\((-|\\+)[0-9]+\\)){0,1} 🛡:(?P<Defense>[0-9]+) Lvl: (?P<Level>[0-9]+)\\nYour result on the battlefield:\\n(🔥Exp: (?P<Exp>[0-9]+)\\n){0,1}(💰Gold: (?P<Gold>\\-{0,1}[0-9]+)\\n){0,1}(📦Stock: (?P<Stock>\\-{0,1}[0-9]+)){0,1}(\\n(?P<Stamina>(🔋Stamina restored))){0,1}(\\n(?P<Crit>(⚡Critical strike))){0,1}$")
|
|
||||||
,(5000, ` + strconv.Itoa(objSubTypeMessageAuctionAnnounce) + `, "Auction annouce", "^Lot #(?P<Lot>[0-9]+) : (?P<Item>.*)\\n(Quality: (?P<Quality>.*)\\n){0,1}(Condition: (?P<Cond>.*)\\n){0,1}Seller: (?P<Seller>.*)\\nCurrent price: (?P<Price>[0-9]+) pouch\\(es\\)\\nBuyer: (?P<Buyer>.*)\\nEnd At: (?P<End>.*)\\nStatus: (?P<Status>.*)(\\n)*(?s:.*)")
|
|
||||||
,(5000, ` + strconv.Itoa(objSubTypeMessageTimeAck) + `, "Time", "^In Chat Wars world now\\n(?P<Time>.*)\\n(?P<Hour>[0-9]{2}):(?P<Minute>[0-9]{2})\\n(?P<Day>[0-9]{2}) (?P<Month>.+) (?P<Year>[0-9]{4})\\n(?s:.*)$")` +
|
|
||||||
`,(5000, ` + strconv.Itoa(objSubTypeMessageMiniWar) + `, "Mini War", "^⛳️Battle results:\\n` +
|
|
||||||
`(?P<Gardian1>🔱){0,1}.*(?P<Loot1>(Moonlight|Wolfpack|Deerhorn|Dragonscale|Sharkteeth|Potato|Highnest)):(?P<Result1>[^\\x{1F4B0}\\x{1F4E6}]*)((?P<Gold1>(\\-|\\+)[0-9]+)\\x{1F4B0}){0,1}[ ]*((?P<Stock1>(\\-|\\+)[0-9]+)\\x{1F4E6}){0,1}\\n` +
|
|
||||||
`(?P<Gardian2>🔱){0,1}.*(?P<Loot2>(Moonlight|Wolfpack|Deerhorn|Dragonscale|Sharkteeth|Potato|Highnest)):(?P<Result2>[^\\x{1F4B0}\\x{1F4E6}]*)((?P<Gold2>(\\-|\\+)[0-9]+)\\x{1F4B0}){0,1}[ ]*((?P<Stock2>(\\-|\\+)[0-9]+)\\x{1F4E6}){0,1}\\n` +
|
|
||||||
`(?P<Gardian3>🔱){0,1}.*(?P<Loot3>(Moonlight|Wolfpack|Deerhorn|Dragonscale|Sharkteeth|Potato|Highnest)):(?P<Result3>[^\\x{1F4B0}\\x{1F4E6}]*)((?P<Gold3>(\\-|\\+)[0-9]+)\\x{1F4B0}){0,1}[ ]*((?P<Stock3>(\\-|\\+)[0-9]+)\\x{1F4E6}){0,1}\\n` +
|
|
||||||
`(?P<Gardian4>🔱){0,1}.*(?P<Loot4>(Moonlight|Wolfpack|Deerhorn|Dragonscale|Sharkteeth|Potato|Highnest)):(?P<Result4>[^\\x{1F4B0}\\x{1F4E6}]*)((?P<Gold4>(\\-|\\+)[0-9]+)\\x{1F4B0}){0,1}[ ]*((?P<Stock4>(\\-|\\+)[0-9]+)\\x{1F4E6}){0,1}\\n` +
|
|
||||||
`(?P<Gardian5>🔱){0,1}.*(?P<Loot5>(Moonlight|Wolfpack|Deerhorn|Dragonscale|Sharkteeth|Potato|Highnest)):(?P<Result5>[^\\x{1F4B0}\\x{1F4E6}]*)((?P<Gold5>(\\-|\\+)[0-9]+)\\x{1F4B0}){0,1}[ ]*((?P<Stock5>(\\-|\\+)[0-9]+)\\x{1F4E6}){0,1}\\n` +
|
|
||||||
`(?P<Gardian6>🔱){0,1}.*(?P<Loot6>(Moonlight|Wolfpack|Deerhorn|Dragonscale|Sharkteeth|Potato|Highnest)):(?P<Result6>[^\\x{1F4B0}\\x{1F4E6}]*)((?P<Gold6>(\\-|\\+)[0-9]+)\\x{1F4B0}){0,1}[ ]*((?P<Stock6>(\\-|\\+)[0-9]+)\\x{1F4E6}){0,1}\\n` +
|
|
||||||
`(?P<Gardian7>🔱){0,1}.*(?P<Loot7>(Moonlight|Wolfpack|Deerhorn|Dragonscale|Sharkteeth|Potato|Highnest)):(?P<Result7>[^\\x{1F4B0}\\x{1F4E6}]*)((?P<Gold7>(\\-|\\+)[0-9]+)\\x{1F4B0}){0,1}[ ]*((?P<Stock7>(\\-|\\+)[0-9]+)\\x{1F4E6}){0,1}\\n` +
|
|
||||||
`\\n🏆Scores:\\n` +
|
|
||||||
`.*(?P<Score1>(Moonlight|Wolfpack|Deerhorn|Dragonscale|Sharkteeth|Potato|Highnest)): (?P<Points1>\\+([0-9]+|NaN))\\n` +
|
|
||||||
`.*(?P<Score2>(Moonlight|Wolfpack|Deerhorn|Dragonscale|Sharkteeth|Potato|Highnest)): (?P<Points2>\\+([0-9]+|NaN))\\n` +
|
|
||||||
`.*(?P<Score3>(Moonlight|Wolfpack|Deerhorn|Dragonscale|Sharkteeth|Potato|Highnest)): (?P<Points3>\\+([0-9]+|NaN))\\n` +
|
|
||||||
`.*(?P<Score4>(Moonlight|Wolfpack|Deerhorn|Dragonscale|Sharkteeth|Potato|Highnest)): (?P<Points4>\\+([0-9]+|NaN))\\n` +
|
|
||||||
`.*(?P<Score5>(Moonlight|Wolfpack|Deerhorn|Dragonscale|Sharkteeth|Potato|Highnest)): (?P<Points5>\\+([0-9]+|NaN))\\n` +
|
|
||||||
`.*(?P<Score6>(Moonlight|Wolfpack|Deerhorn|Dragonscale|Sharkteeth|Potato|Highnest)): (?P<Points6>\\+([0-9]+|NaN))\\n` +
|
|
||||||
`.*(?P<Score7>(Moonlight|Wolfpack|Deerhorn|Dragonscale|Sharkteeth|Potato|Highnest)): (?P<Points7>\\+([0-9]+|NaN))\\n` +
|
|
||||||
`(?s:.*)` +
|
|
||||||
`Battle (?P<Time>[0-9]{2}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2})$")
|
|
||||||
,(5000, ` + strconv.Itoa(objSubTypeMessagePillageInc) + `, "Pillage Inc", "^You were strolling around on your horse when you noticed (\\[(?P<Guild>[A-Z0-9]{1,3})\\]){0,1}(?P<Attacker>.*) of .{1}(?P<Castle>(Moonlight|Wolfpack|Deerhorn|Dragonscale|Sharkteeth|Potato|Highnest)) Castle trying to pillage a local village. To stop him click /go$")
|
|
||||||
,(5000, ` + strconv.Itoa(objSubTypeMessageGo) + `, "Go", "^/go$")
|
|
||||||
,(5000, ` + strconv.Itoa(objSubTypeMessagePillageGo) + `,"Pillage Go", "^You lift up your sword and charge at the violator.$")
|
|
||||||
,(5000, ` + strconv.Itoa(objSubTypeMessagePillageWin) + `,"Pillage Win", "^You successfully defeated (\\[(?P<Guild>[A-Z0-9]{1,3})\\]){0,1}(?P<Attacker>.*). As he was crawling away, you picked up some of the gold he left behind. Received (?P<Gold>[0-9]+) gold and (?P<Exp>[0-9]+) exp.$")
|
|
||||||
,(5000, ` + strconv.Itoa(objSubTypeMessagePillageTimeout) + `,"Pillage Timeout", "^You\\'ve failed to protect the villagers. No more rewards for you.$")
|
|
||||||
,(5000, ` + strconv.Itoa(objSubTypeMessageDuelFight) + `, "Duel Fight result #2", "(?P<Life1>(\\-){0,1}[0-9]+).*(?P<Castle1>[🐉🦅🐺🦈🦌🥔🌑])(\\[(?P<Guild1>[A-Z0-9]{1,3})\\]){0,1}(?P<Duelist1>.*)\\n` +
|
|
||||||
`VS\\n` +
|
|
||||||
`(?P<Life2>(\\-){0,1}[0-9]+).*(?P<Castle2>[🐉🦅🐺🦈🦌🥔🌑])(\\[(?P<Guild2>[A-Z0-9]{1,3})\\]){0,1}(?P<Duelist2>.*)\\n` +
|
|
||||||
`(?s:.*)\\n` +
|
|
||||||
`(\\[(?P<WinGuild>[A-Z0-9]{1,3})\\]){0,1}(?P<WinDuelist>.*) from .*(?P<WinCastle>[🐉🦅🐺🦈🦌🥔🌑]).* Castle stands victorious over (\\[(?P<LossGuild>[A-Z0-9]{1,3})\\]){0,1}(?P<LossDuelist>.*) from .*(?P<LossCastle>[🐉🦅🐺🦈🦌🥔🌑]).* Castle, with blood slowly dripping from his (?P<Weapon>.*).\\n` +
|
|
||||||
`You received: (?P<Exp>[0-9]+) exp.\\n` +
|
|
||||||
`(?s:.*)$")
|
|
||||||
,(5000, ` + strconv.Itoa(objSubTypeMessageDuelFight) + `, "Duel Fight result #1", "(?P<Life1>(\\-){0,1}[0-9]+).*(?P<Castle1>[🐉🦅🐺🦈🦌🥔🌑])(\\[(?P<Guild1>[A-Z0-9]{1,3})\\]){0,1}(?P<Duelist1>.*)\\n` +
|
|
||||||
`VS\\n` +
|
|
||||||
`(?P<Life2>(\\-){0,1}[0-9]+).*(?P<Castle2>[🐉🦅🐺🦈🦌🥔🌑])(\\[(?P<Guild2>[A-Z0-9]{1,3})\\]){0,1}(?P<Duelist2>.*)\\n` +
|
|
||||||
`(?s:.*)\\n` +
|
|
||||||
`(\\[(?P<WinGuild>[A-Z0-9]{1,3})\\]){0,1}(?P<WinDuelist>.*) from .*(?P<WinCastle>[🐉🦅🐺🦈🦌🥔🌑]).* Castle was stronger than (\\[(?P<LossGuild>[A-Z0-9]{1,3})\\]){0,1}(?P<LossDuelist>.*) from .*(?P<LossCastle>[🐉🦅🐺🦈🦌🥔🌑]).* Castle.\\n` +
|
|
||||||
`You received: (?P<Exp>[0-9]+) exp.\\n` +
|
|
||||||
`(?s:.*)$")
|
|
||||||
;`)
|
|
||||||
failOnError(err, "resetMsgParsingRules : populate table msg_rules")
|
|
||||||
}
|
|
||||||
|
|
||||||
func putUnprocessedMsg(m ChatWarsMessage) (int64, error) {
|
func putUnprocessedMsg(m ChatWarsMessage) (int64, error) {
|
||||||
tx, err := db.Begin()
|
tx, err := db.Begin()
|
||||||
logOnError(err, "putUnprocessedMsg : start transaction")
|
logOnError(err, "putUnprocessedMsg : start transaction")
|
||||||
|
21
workers.go
21
workers.go
@ -126,6 +126,27 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
|
|||||||
case objSubTypeMessageGo:
|
case objSubTypeMessageGo:
|
||||||
err = setObjSubTypeId(objId, objSubTypeMessageGo)
|
err = setObjSubTypeId(objId, objSubTypeMessageGo)
|
||||||
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(Go)")
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(Go)")
|
||||||
|
case objSubTypeMessageReportReq:
|
||||||
|
err = setObjSubTypeId(objId, objSubTypeMessageReportReq)
|
||||||
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(ReportReq)")
|
||||||
|
case objSubTypeMessageGReportReq:
|
||||||
|
err = setObjSubTypeId(objId, objSubTypeMessageGReportReq)
|
||||||
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(GReportReq)")
|
||||||
|
case objSubTypeMessageHeroReq:
|
||||||
|
err = setObjSubTypeId(objId, objSubTypeMessageHeroReq)
|
||||||
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(HeroReq)")
|
||||||
|
case objSubTypeMessageMeReq:
|
||||||
|
err = setObjSubTypeId(objId, objSubTypeMessageMeReq)
|
||||||
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(MeReq)")
|
||||||
|
case objSubTypeMessageInventoryReq:
|
||||||
|
err = setObjSubTypeId(objId, objSubTypeMessageInventoryReq)
|
||||||
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(InventoryReq)")
|
||||||
|
case objSubTypeMessageTimeReq:
|
||||||
|
err = setObjSubTypeId(objId, objSubTypeMessageTimeReq)
|
||||||
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(TimeReq)")
|
||||||
|
case objSubTypeMessagePledge:
|
||||||
|
err = setObjSubTypeId(objId, objSubTypeMessagePledge)
|
||||||
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(Pledge)")
|
||||||
case objSubTypeMessagePillageGo:
|
case objSubTypeMessagePillageGo:
|
||||||
err = setObjSubTypeId(objId, objSubTypeMessagePillageGo)
|
err = setObjSubTypeId(objId, objSubTypeMessagePillageGo)
|
||||||
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(PillageGo)")
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(PillageGo)")
|
||||||
|
Loading…
Reference in New Issue
Block a user