This commit is contained in:
shoopea 2019-05-18 16:33:58 +08:00
parent 5725b86d20
commit 4013c87e3f
2 changed files with 10 additions and 10 deletions

18
sql.go
View File

@ -1297,7 +1297,7 @@ func resetMsgParsingRules() {
failOnError(err, "resetMsgParsingRules : truncate table msg_rules") failOnError(err, "resetMsgParsingRules : truncate table msg_rules")
_, err = db.Exec(`INSERT INTO msg_rules (prio, msg_type_id, descn, rule) _, 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-Z]{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}$") 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(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(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` + `,(5000, ` + strconv.Itoa(objSubTypeMessageMiniWar) + `, "Mini War", "^⛳Battle results:\\n` +
@ -1318,7 +1318,7 @@ func resetMsgParsingRules() {
`.*(?P<Score7>(Moonlight|Wolfpack|Deerhorn|Dragonscale|Sharkteeth|Potato|Highnest)): (?P<Points7>\\+([0-9]+|NaN))\\n` + `.*(?P<Score7>(Moonlight|Wolfpack|Deerhorn|Dragonscale|Sharkteeth|Potato|Highnest)): (?P<Points7>\\+([0-9]+|NaN))\\n` +
`(?s:.*)` + `(?s:.*)` +
`Battle (?P<Time>[0-9]{2}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2})$") `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-Z]{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(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$")` +
`;`) `;`)
failOnError(err, "resetMsgParsingRules : populate table msg_rules") failOnError(err, "resetMsgParsingRules : populate table msg_rules")
} }
@ -1567,19 +1567,19 @@ func insertMsgPillageInc(m *ChatWarsMessagePillageInc) error {
switch m.Castle { switch m.Castle {
case "Deerhorn": case "Deerhorn":
_, err = stmt.Exec(m.ObjID64, m.Attacker, castleDeer) _, err = stmt.Exec(m.ObjID64, m.Attacker, m.Guild, castleDeer)
case "Dragonscale": case "Dragonscale":
_, err = stmt.Exec(m.ObjID64, m.Attacker, castleDragon) _, err = stmt.Exec(m.ObjID64, m.Attacker, m.Guild, castleDragon)
case "Highnest": case "Highnest":
_, err = stmt.Exec(m.ObjID64, m.Attacker, castleHighnest) _, err = stmt.Exec(m.ObjID64, m.Attacker, m.Guild, castleHighnest)
case "Moonlight": case "Moonlight":
_, err = stmt.Exec(m.ObjID64, m.Attacker, castleMoon) _, err = stmt.Exec(m.ObjID64, m.Attacker, m.Guild, castleMoon)
case "Potato": case "Potato":
_, err = stmt.Exec(m.ObjID64, m.Attacker, castlePotato) _, err = stmt.Exec(m.ObjID64, m.Attacker, m.Guild, castlePotato)
case "Sharkteeth": case "Sharkteeth":
_, err = stmt.Exec(m.ObjID64, m.Attacker, castleShark) _, err = stmt.Exec(m.ObjID64, m.Attacker, m.Guild, castleShark)
case "Wolfpack": case "Wolfpack":
_, err = stmt.Exec(m.ObjID64, m.Attacker, castleWolf) _, err = stmt.Exec(m.ObjID64, m.Attacker, m.Guild, castleWolf)
} }
if err != nil { if err != nil {
return err return err

View File

@ -105,7 +105,7 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Parsing objSubTypeMessageMiniWar.") logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Parsing objSubTypeMessageMiniWar.")
cwm.ObjID64 = objId cwm.ObjID64 = objId
err = insertMsgPillageInc(cwm) err = insertMsgPillageInc(cwm)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : insertMsgMiniWar") logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : insertMsgPillageInc")
err = setObjSubTypeId(objId, objSubTypeMessagePillageInc) err = setObjSubTypeId(objId, objSubTypeMessagePillageInc)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(PillageInc)") logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(PillageInc)")
if m.Date.Add(3 * time.Minute).After(time.Now()) { if m.Date.Add(3 * time.Minute).After(time.Now()) {