diff --git a/def.go b/def.go index 5db7145..2ef83b8 100644 --- a/def.go +++ b/def.go @@ -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 diff --git a/sql.go b/sql.go index 36a7e11..6098af5 100644 --- a/sql.go +++ b/sql.go @@ -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[A-Z0-9]{1,3})\\]){0,1}(?P.*). As he was crawling away, you picked up some of the gold he left behind. Received (?P[0-9]+) gold and (?P[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") } diff --git a/workers.go b/workers.go index 8af5fb0..24bb2e5 100644 --- a/workers.go +++ b/workers.go @@ -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)")