update ambush
This commit is contained in:
parent
749979b593
commit
0338338c14
2
def.go
2
def.go
@ -208,7 +208,7 @@ type ChatWarsMessageQuestResult struct {
|
||||
type ChatWarsMessageQuestResultAmbush struct {
|
||||
Msg *ChatWarsMessage `json:"msg"`
|
||||
Loot []ChatWarsItems `json:"loot"`
|
||||
Level int `json:"level"`
|
||||
Level int64 `json:"level"`
|
||||
Armored bool `json:"armored"`
|
||||
Enraged bool `json:"enraged"`
|
||||
SpearResists bool `json:"spear resists"`
|
||||
|
11
msg.go
11
msg.go
@ -428,7 +428,7 @@ func parseSubTypeMessageDuelFight(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWa
|
||||
}
|
||||
|
||||
func parseSubTypeMessageQuestResultAmbush(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageQuestResultAmbush, error) {
|
||||
var level float64
|
||||
var lvlSum, qtySum int64
|
||||
|
||||
cwm := ChatWarsMessageQuestResultAmbush{}
|
||||
|
||||
@ -446,9 +446,16 @@ func parseSubTypeMessageQuestResultAmbush(m *ChatWarsMessage, r *regexp.Regexp)
|
||||
}
|
||||
lvl, _ := strconv.ParseInt(l[4], 10, 64)
|
||||
log.Printf("parseSubTypeMessageQuestResultAmbush : lvl : %d\n", lvl)
|
||||
level = level + float64(lvl*qty)
|
||||
|
||||
lvlSum = lvlSum + lvl
|
||||
qtySum = qtySum + qty
|
||||
|
||||
}
|
||||
cwm.Level = lvlSum / qtySum
|
||||
cwm.Msg = m
|
||||
|
||||
log.Printf("parseSubTypeMessageQuestResultAmbush : Level : %d\n", cwm.Level)
|
||||
|
||||
return &cwm, nil
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,8 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
|
||||
case objSubTypeMessageQuestResultAmbush:
|
||||
_, err := parseSubTypeMessageQuestResultAmbush(m, rule.re)
|
||||
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Parsing objSubTypeMessageQuestResultAmbush.")
|
||||
if m.Date.Add(3*time.Minute).After(time.Now()) && m.ChatID64 == chtwrsbotID64 {
|
||||
if m.Date.Add(3 * time.Minute).After(time.Now().UTC()) {
|
||||
if m.ChatID64 == chtwrsbotID64 {
|
||||
s := TGCommand{
|
||||
Type: commandForwardMsg,
|
||||
FromUserID64: m.TGUserID64,
|
||||
@ -395,6 +396,9 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
|
||||
ToChatID64: cfg.Bot.Mainchat,
|
||||
}
|
||||
MQTGCmdQueue <- s
|
||||
} else if m.ChatID64 == cfg.Bot.Mainchat {
|
||||
|
||||
}
|
||||
}
|
||||
case objSubTypeMessagePillageInc:
|
||||
cwm, err := parseSubTypeMessagePillageInc(m, rule.re)
|
||||
|
Loading…
Reference in New Issue
Block a user