Files
bl/logic/service/maps/walk.go
2025-11-09 06:50:12 +00:00

55 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package maps
import (
"blazing/cool"
"blazing/logic/service/common"
"blazing/logic/service/player"
"blazing/logic/service/space"
"blazing/modules/blazing/model"
"github.com/gogf/gf/v2/util/gconv"
"golang.org/x/time/rate"
)
type WalkInInfo struct {
Head player.TomeeHeader `cmd:"2101" struc:"[0]pad"` //走路包
// Flag: 0为走1为飞行模式@UInt long
Flag uint32
// Point: 直接给坐标xy
Point model.Pos `fieldDesc:"直接给坐标xy"`
PathLen uint32 `struc:"sizeof=Path" `
Path string
}
func (t *WalkInInfo) Broadcast(mapid uint32, o WalkOutInfo) {
r := cool.Limiter.Get("Broadcast"+gconv.String(mapid), rate.Limit(10), 5)
if !r.Allow() {
return
}
space.GetSpace(mapid).User.IterCb(func(playerID uint32, player common.PlayerI) {
t.Head.Result = 0
tt := t.Head.Pack(&o)
player.SendPack(tt)
})
}
// PeopleWalkOutboundInfo PeopleWalkOutboundInfo类实现OutboundMessage接口
type WalkOutInfo struct {
// Flag: 0为走1为飞行模式
Flag uint32 `fieldDesc:"0为走1为飞行模式" codec:"uint"`
// UserID: 走动的人的米米号
UserID uint32 `fieldDesc:"走动的人的米米号" codec:"uint"`
// Point: 直接给坐标xy
Point model.Pos `fieldDesc:"直接给坐标xy"`
PathLen uint32 `struc:"sizeof=Path" `
Path string
}