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 objSubTypeMessageInventory = 311
objSubTypeMessagePillageInc = 312 objSubTypeMessagePillageInc = 312
objSubTypeMessagePillageGo = 313 objSubTypeMessagePillageGo = 313
objSubTypeMessagePillageWin = 314 objSubTypeMessagePillageTimeout = 314
objSubTypeMessagePillageLoss = 315 objSubTypeMessagePillageWin = 315
objSubTypeMessageTributeInc = 316 objSubTypeMessagePillageLoss = 316
objSubTypeMessageTributeAck = 317 objSubTypeMessageTributeInc = 317
objSubTypeMessageAuctionAnnounce = 318 objSubTypeMessageTributeAck = 318
objSubTypeMessageAuctionUpdReq = 319 objSubTypeMessageAuctionAnnounce = 319
objSubTypeMessageAuctionUpdAck = 320 objSubTypeMessageAuctionUpdReq = 320
objSubTypeMessageTimeAck = 321 objSubTypeMessageAuctionUpdAck = 321
objSubTypeMessageTimeReq = 322 objSubTypeMessageTimeAck = 322
objSubTypeMessageGo = 323 objSubTypeMessageTimeReq = 323
objSubTypeMessageGo = 324
objSubTypeJobPillage = 601 objSubTypeJobPillage = 601
objSubTypeJobTribute = 602 objSubTypeJobTribute = 602
objSubTypeJobStatus = 603 objSubTypeJobStatus = 603

1
sql.go
View File

@ -1325,6 +1325,7 @@ func resetMsgParsingRules() {
,(5000, ` + strconv.Itoa(objSubTypeMessageGo) + `, "Go", "^/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(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(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") 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") 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()) {
p := JobPayloadPillage{ p := JobPayloadPillage{
ObjID64: objId, ObjID64: objId,
} }
b, _ := json.Marshal(&p) b, _ := json.Marshal(&p)
err = createJob(objSubTypeJobPillage, objJobPriority, m.UserID64, m.Date.Add(time.Duration(25+rand.Intn(35))*time.Second), b) 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)") logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : createJob(JobPillage)")
/* // only advertise live pillages
if m.Date.Add(3 * time.Minute).After(time.Now()) {
s := TGCommand{ s := TGCommand{
Type: commandSendMsg, Type: commandSendMsg,
Text: fmt.Sprintf("Catching pillage (%s)", m.Date.Format(time.RFC3339)), Text: fmt.Sprintf("Catching pillage (%s)", m.Date.Format(time.RFC3339)),
ToUserID64: m.UserID64, ToUserID64: m.UserID64,
} }
TGCmdQueue <- s TGCmdQueue <- s
*/ }
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 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)")
case objSubTypeMessagePillageTimeout:
err = setObjSubTypeId(objId, objSubTypeMessagePillageTimeout)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(PillageTimeout)")
case objSubTypeMessagePillageWin: case objSubTypeMessagePillageWin:
err = setObjSubTypeId(objId, objSubTypeMessagePillageWin) err = setObjSubTypeId(objId, objSubTypeMessagePillageWin)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(PillageWin)") logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(PillageWin)")