diff --git a/cron.go b/cron.go index 0e13aad..848ffed 100644 --- a/cron.go +++ b/cron.go @@ -14,6 +14,7 @@ func startCron() *cron.Cron { c.AddFunc("58 6,14,22 * * *", cronSetDef) c.AddFunc("02 1,3,5,9,11,13,17,19,21 * * *", cronGetHammerTime) c.AddFunc("10 7,15,23 * * *", cronGetHammerTime) + c.AddFunc("13 3, 7, 11, 15, 19, 23 * * *", cronTribute) c.Start() return c } @@ -40,6 +41,17 @@ func cronSendWarReport() { return } +func cronSendWarReport() { + muxClients.RLock() + for _, c := range clients { + if c.Active && c.Class == `Knight` { + clientSendCWMsgDelay(c.TGUserID64, `/tributes`, 0) + } + } + muxClients.RUnlock() + return +} + func cronSetDef() { muxClients.RLock() for _, c := range clients { diff --git a/data/code_obj_sub_type.json b/data/code_obj_sub_type.json index 9e8bbc2..7ceaf49 100644 --- a/data/code_obj_sub_type.json +++ b/data/code_obj_sub_type.json @@ -539,6 +539,11 @@ "name": "NY 2020 Event Fight is over", "obj_type": "msg" }, + { + "intl_id": "msg_ny2020_round_done", + "name": "NY 2020 Event Round finished", + "obj_type": "msg" + }, { "intl_id": "job_pillage", "name": "Pillage job", diff --git a/data/msg_rules.json b/data/msg_rules.json index e59cd45..9693917 100644 --- a/data/msg_rules.json +++ b/data/msg_rules.json @@ -1774,5 +1774,13 @@ "msg_type": "msg_ny2020_fight_over", "chat_id": -1001198527605, "user_id": 841616455 + }, + { + "prio": 5000, + "descn": "NY2020 Event Round Done", + "rule": "^Green creatures are eliminated\\. But slack not\\! There will be an another party\\! All the icicles became timeless\\!", + "msg_type": "msg_ny2020_round_done", + "chat_id": -1001198527605, + "user_id": 841616455 } ] \ No newline at end of file diff --git a/msg.go b/msg.go index 0a2f29a..a06764d 100644 --- a/msg.go +++ b/msg.go @@ -273,6 +273,7 @@ func parseSubTypeMessageMeAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMe CWUserID64: getObjUserID(r.ReplaceAllString(m.Text, "${Player}")), CWGuildID64: getObjGuildID(r.ReplaceAllString(m.Text, "${Guild}")), State: r.ReplaceAllString(m.Text, "${State}"), + Class: r.ReplaceAllString(m.Text, "${Class}"), } i, _ = strconv.ParseInt(r.ReplaceAllString(m.Text, "${ExpNow}"), 10, 64) cwm.ExpNow = i