update cron with tributes

This commit is contained in:
shoopea 2020-01-06 14:55:13 +08:00
parent 7b28951acb
commit fba88dfc42
4 changed files with 26 additions and 0 deletions

12
cron.go
View File

@ -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 {

View File

@ -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",

View File

@ -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
}
]

1
msg.go
View File

@ -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