2025-09-14 01:35:16 +08:00
|
|
|
|
package maps
|
2025-08-15 22:44:28 +08:00
|
|
|
|
|
|
|
|
|
|
import (
|
2025-10-10 20:46:16 +08:00
|
|
|
|
"blazing/logic/service/common"
|
2025-09-14 01:35:16 +08:00
|
|
|
|
"blazing/logic/service/player"
|
|
|
|
|
|
"blazing/logic/service/space"
|
|
|
|
|
|
|
2025-08-15 22:44:28 +08:00
|
|
|
|
"blazing/modules/blazing/model"
|
2025-11-09 06:50:12 +00:00
|
|
|
|
|
|
|
|
|
|
"golang.org/x/time/rate"
|
2025-08-15 22:44:28 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
2025-09-14 01:35:16 +08:00
|
|
|
|
type WalkInInfo struct {
|
|
|
|
|
|
Head player.TomeeHeader `cmd:"2101" struc:"[0]pad"` //走路包
|
2025-08-26 23:22:10 +00:00
|
|
|
|
// Flag: 0为走,1为飞行模式,@UInt long
|
2025-08-15 22:44:28 +08:00
|
|
|
|
Flag uint32
|
|
|
|
|
|
|
|
|
|
|
|
// Point: 直接给坐标x,y
|
|
|
|
|
|
Point model.Pos `fieldDesc:"直接给坐标x,y"`
|
|
|
|
|
|
|
2025-10-30 01:37:53 +00:00
|
|
|
|
PathLen uint32 `struc:"sizeof=Path" `
|
2025-10-31 00:53:22 +08:00
|
|
|
|
Path string
|
2025-08-15 22:44:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-11 01:10:26 +08:00
|
|
|
|
var limiter = rate.NewLimiter(rate.Limit(10), 1)
|
2025-08-15 22:44:28 +08:00
|
|
|
|
|
2025-11-11 01:10:26 +08:00
|
|
|
|
func (t *WalkInInfo) Broadcast(mapid uint32, o WalkOutInfo) {
|
|
|
|
|
|
// cool.Limiter.Take()
|
|
|
|
|
|
//r := cool.Limiter.Get("Broadcast"+gconv.String(mapid), rate.Limit(10), 5)
|
|
|
|
|
|
if !limiter.Allow() {
|
2025-11-09 06:50:12 +00:00
|
|
|
|
return
|
|
|
|
|
|
}
|
2025-10-10 20:46:16 +08:00
|
|
|
|
space.GetSpace(mapid).User.IterCb(func(playerID uint32, player common.PlayerI) {
|
2025-08-17 21:55:15 +08:00
|
|
|
|
t.Head.Result = 0
|
|
|
|
|
|
tt := t.Head.Pack(&o)
|
2025-10-10 20:46:16 +08:00
|
|
|
|
player.SendPack(tt)
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2025-08-15 22:44:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-26 23:22:10 +00:00
|
|
|
|
// PeopleWalkOutboundInfo PeopleWalkOutboundInfo类,实现OutboundMessage接口
|
2025-09-14 01:35:16 +08:00
|
|
|
|
type WalkOutInfo struct {
|
2025-08-15 22:44:28 +08:00
|
|
|
|
// Flag: 0为走,1为飞行模式
|
|
|
|
|
|
Flag uint32 `fieldDesc:"0为走,1为飞行模式" codec:"uint"`
|
|
|
|
|
|
|
|
|
|
|
|
// UserID: 走动的人的米米号
|
|
|
|
|
|
UserID uint32 `fieldDesc:"走动的人的米米号" codec:"uint"`
|
|
|
|
|
|
|
|
|
|
|
|
// Point: 直接给坐标x,y
|
|
|
|
|
|
Point model.Pos `fieldDesc:"直接给坐标x,y"`
|
|
|
|
|
|
|
2025-10-30 01:37:53 +00:00
|
|
|
|
PathLen uint32 `struc:"sizeof=Path" `
|
2025-10-31 00:53:22 +08:00
|
|
|
|
Path string
|
2025-08-15 22:44:28 +08:00
|
|
|
|
}
|