update cron for tributes
This commit is contained in:
parent
bf4344e412
commit
f792d2c1d2
16
client.go
16
client.go
@ -301,6 +301,22 @@ func clientMsgMeAck(m *ChatWarsMessageMeAck) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func clientMsgGListAck(msg *ChatWarsMessageGListAck) {
|
||||||
|
muxClients.Lock()
|
||||||
|
for _, clt := range clients {
|
||||||
|
for _, m := range msg.Members {
|
||||||
|
clt.Mux.Lock()
|
||||||
|
if m.Name == clt.Nickname {
|
||||||
|
if m.Class2 == `⚔️` {
|
||||||
|
clt.CWClass2 = `Knight`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
clt.Mux.Unlock()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
muxClients.Unlock()
|
||||||
|
}
|
||||||
|
|
||||||
func clientMsgGoQuestAck(m *ChatWarsMessageGoQuestAck) {
|
func clientMsgGoQuestAck(m *ChatWarsMessageGoQuestAck) {
|
||||||
if clt, ok := getLockedClient(m.Msg.TGUserID64, false); ok {
|
if clt, ok := getLockedClient(m.Msg.TGUserID64, false); ok {
|
||||||
if clt.Active {
|
if clt.Active {
|
||||||
|
2
cron.go
2
cron.go
@ -77,7 +77,7 @@ func cronTribute() {
|
|||||||
muxClients.RLock()
|
muxClients.RLock()
|
||||||
for _, c := range clients {
|
for _, c := range clients {
|
||||||
if c.Active {
|
if c.Active {
|
||||||
if c.CWClass == `Knight` {
|
if c.CWClass == `Knight` || c.CWClass2 == `Knight` {
|
||||||
clientSendCWMsgDelay(c.TGUserID64, `/tributes`, 0)
|
clientSendCWMsgDelay(c.TGUserID64, `/tributes`, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
msg.go
4
msg.go
@ -472,7 +472,7 @@ func parseSubTypeMessageGListAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWar
|
|||||||
cwm.Msg = m
|
cwm.Msg = m
|
||||||
cwm.Members = make([]ChatWarsGuildMember, 0)
|
cwm.Members = make([]ChatWarsGuildMember, 0)
|
||||||
|
|
||||||
log.Printf("parseSubTypeMessageGListAck : Guild : %s\n", r.ReplaceAllString(m.Text, "${GuildName}"))
|
//log.Printf("parseSubTypeMessageGListAck : Guild : %s\n", r.ReplaceAllString(m.Text, "${GuildName}"))
|
||||||
// log.Printf("parseSubTypeMessageGListAck : Members : %s\n", r.ReplaceAllString(m.Text, "${Members}"))
|
// log.Printf("parseSubTypeMessageGListAck : Members : %s\n", r.ReplaceAllString(m.Text, "${Members}"))
|
||||||
|
|
||||||
re := regexp.MustCompile(`\n#(?P<Id>[0-9]+) (?P<Class1>(⚒|⚗️|📦|🏹|⚔️|🛡))(?P<Class2>(⚒|⚗️|📦|🏹|⚔️|🛡){0,1})(?P<Level>[0-9]+) \[(?P<Status>.*)\] (?P<Name>[a-zA-z0-9 ]+)`)
|
re := regexp.MustCompile(`\n#(?P<Id>[0-9]+) (?P<Class1>(⚒|⚗️|📦|🏹|⚔️|🛡))(?P<Class2>(⚒|⚗️|📦|🏹|⚔️|🛡){0,1})(?P<Level>[0-9]+) \[(?P<Status>.*)\] (?P<Name>[a-zA-z0-9 ]+)`)
|
||||||
@ -485,7 +485,7 @@ func parseSubTypeMessageGListAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWar
|
|||||||
m.Status = re.ReplaceAllString(l, "${Status}")
|
m.Status = re.ReplaceAllString(l, "${Status}")
|
||||||
i, _ := strconv.ParseInt(re.ReplaceAllString(l, "${Level}"), 10, 64)
|
i, _ := strconv.ParseInt(re.ReplaceAllString(l, "${Level}"), 10, 64)
|
||||||
m.Level = int(i)
|
m.Level = int(i)
|
||||||
log.Printf("parseSubTypeMessageGListAck : %s : %s/%s [%d] => %s\n", m.Name, m.Class1, m.Class2, m.Level, m.Status)
|
//log.Printf("parseSubTypeMessageGListAck : %s : %s/%s [%d] => %s\n", m.Name, m.Class1, m.Class2, m.Level, m.Status)
|
||||||
cwm.Members = append(cwm.Members, m)
|
cwm.Members = append(cwm.Members, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user