This commit is contained in:
shoopea 2019-05-18 18:59:43 +08:00
parent cbfd8ab06e
commit 156539ee4b
3 changed files with 18 additions and 13 deletions

21
def.go
View File

@ -167,16 +167,17 @@ const (
objSubTypeMessageInventory = 311
objSubTypeMessagePillageInc = 312
objSubTypeMessagePillageGo = 313
objSubTypeMessagePillageWin = 314
objSubTypeMessagePillageLoss = 315
objSubTypeMessageTributeInc = 316
objSubTypeMessageTributeAck = 317
objSubTypeMessageAuctionAnnounce = 318
objSubTypeMessageAuctionUpdReq = 319
objSubTypeMessageAuctionUpdAck = 320
objSubTypeMessageTimeAck = 321
objSubTypeMessageTimeReq = 322
objSubTypeMessageGo = 323
objSubTypeMessagePillageTimeout = 314
objSubTypeMessagePillageWin = 315
objSubTypeMessagePillageLoss = 316
objSubTypeMessageTributeInc = 317
objSubTypeMessageTributeAck = 318
objSubTypeMessageAuctionAnnounce = 319
objSubTypeMessageAuctionUpdReq = 320
objSubTypeMessageAuctionUpdAck = 321
objSubTypeMessageTimeAck = 322
objSubTypeMessageTimeReq = 323
objSubTypeMessageGo = 324
objSubTypeJobPillage = 601
objSubTypeJobTribute = 602
objSubTypeJobStatus = 603

1
sql.go
View File

@ -1325,6 +1325,7 @@ func resetMsgParsingRules() {
,(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.$")
;`)
failOnError(err, "resetMsgParsingRules : populate table msg_rules")
}

View File

@ -108,27 +108,30 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : insertMsgPillageInc")
err = setObjSubTypeId(objId, objSubTypeMessagePillageInc)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(PillageInc)")
// if m.Date.Add(3 * time.Minute).After(time.Now()) {
p := JobPayloadPillage{
ObjID64: objId,
}
b, _ := json.Marshal(&p)
err = createJob(objSubTypeJobPillage, objJobPriority, m.UserID64, m.Date.Add(time.Duration(25+rand.Intn(35))*time.Second), b)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : createJob(JobPillage)")
/*
// only advertise live pillages
if m.Date.Add(3 * time.Minute).After(time.Now()) {
s := TGCommand{
Type: commandSendMsg,
Text: fmt.Sprintf("Catching pillage (%s)", m.Date.Format(time.RFC3339)),
ToUserID64: m.UserID64,
}
TGCmdQueue <- s
*/
}
case objSubTypeMessageGo:
err = setObjSubTypeId(objId, objSubTypeMessageGo)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(Go)")
case objSubTypeMessagePillageGo:
err = setObjSubTypeId(objId, objSubTypeMessagePillageGo)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(PillageGo)")
case objSubTypeMessagePillageTimeout:
err = setObjSubTypeId(objId, objSubTypeMessagePillageTimeout)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(PillageTimeout)")
case objSubTypeMessagePillageWin:
err = setObjSubTypeId(objId, objSubTypeMessagePillageWin)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(PillageWin)")