feat: 增强踢人逻辑与BOSS脚本支持
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
优化踢人超时处理和僵尸连接清理,支持BOSS动作脚本并增加测试,修复事件匹配与战斗循环中的并发问题。
This commit is contained in:
@@ -221,14 +221,15 @@ func (ret *Space) init() {
|
||||
|
||||
}
|
||||
func (p *Space) IsMatch(t model.Event) bool {
|
||||
_, ok := lo.Find(t.Weather, func(item int32) bool {
|
||||
return item == int32(p.MapBossSInfo.Wer)
|
||||
})
|
||||
if !ok {
|
||||
|
||||
return false
|
||||
|
||||
if len(t.Weather) > 0 {
|
||||
_, ok := lo.Find(t.Weather, func(item int32) bool {
|
||||
return item == int32(p.MapBossSInfo.Wer)
|
||||
})
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if t.StartTime != "" && t.EndTime != "" {
|
||||
ok, _ := utils.IsCurrentTimeInRange(t.StartTime, t.EndTime)
|
||||
if !ok {
|
||||
@@ -236,6 +237,20 @@ func (p *Space) IsMatch(t model.Event) bool {
|
||||
}
|
||||
}
|
||||
|
||||
if len(t.Week) > 0 {
|
||||
week := int32(time.Now().Weekday())
|
||||
if week == 0 {
|
||||
week = 7
|
||||
}
|
||||
|
||||
_, ok := lo.Find(t.Week, func(item int32) bool {
|
||||
return item == week
|
||||
})
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user