Files
bl/logic/controller/action_超时空隧道.go
xinian d83cf365ac
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
更新说明
2026-04-05 23:13:06 +08:00

54 lines
1.4 KiB
Go

package controller
import (
"blazing/common/socket/errorcode"
"blazing/logic/service/common"
"blazing/logic/service/player"
"blazing/modules/config/service"
"github.com/samber/lo"
)
// 进入超时空隧道
func (h Controller) TimeMap(data *C2s_SP, c *player.Player) (result *S2C_SP, err errorcode.ErrorCode) {
result = &S2C_SP{}
maps := service.NewMapService().GetTimeMap()
result.MapList = make([]ServerInfo, len(maps))
for i, v := range maps {
result.MapList[i].ID = v.MapID
result.MapList[i].DropItemIds = v.DropItemIds
pits := service.NewMapPitService().GetDataALL(v.MapID)
for _, v := range pits {
result.MapList[i].Pet = append(result.MapList[i].Pet, v.RefreshID...)
}
result.MapList[i].Pet = lo.Union(result.MapList[i].Pet)
}
return
}
// C2s_SP 定义请求或响应数据结构。
type C2s_SP struct {
Head common.TomeeHeader `cmd:"60002" struc:"skip"` //超时空地图
}
// OutInfo 表示地图热度的出站消息
type S2C_SP struct {
MapListLen uint32 `struc:"sizeof=MapList"`
MapList []ServerInfo
}
// ServerInfo 定义请求或响应数据结构。
type ServerInfo struct {
ID uint32 //地图ID
PetLen uint32 `struc:"sizeof=Pet"`
Pet []uint32 //拥有的精灵
DropItemIdsLen uint32 `struc:"sizeof=DropItemIds"`
DropItemIds []uint32 //掉落物
GameLen uint32 `struc:"sizeof=Game"`
Game string
}