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

112 lines
3.8 KiB
Go

package controller
import (
"blazing/cool"
"blazing/logic/service/common"
"blazing/modules/player/model"
"context"
"encoding/hex"
"fmt"
"hash/crc32"
)
// MAIN_LOGIN_IN 定义请求或响应数据结构。
type MAIN_LOGIN_IN struct {
Head common.TomeeHeader `cmd:"1001" struc:"skip"`
Sid []byte `struc:"[16]byte"`
}
// CheakSession 处理控制器请求。
func (l *MAIN_LOGIN_IN) CheakSession() (bool, uint32) {
t1 := hex.EncodeToString(l.Sid)
r, err := cool.CacheManager.Get(context.Background(), fmt.Sprintf("session:%d", l.Head.UserID))
if err != nil {
return false, 0
}
if r.String() != t1 {
return false, 0
}
crc32Table := crc32.MakeTable(crc32.IEEE)
crcValue := crc32.Checksum([]byte(l.Sid), crc32Table)
cool.CacheManager.Remove(context.Background(), fmt.Sprintf("session:%d", l.Head.UserID))
return true, crcValue
}
// SimUserInfoInboundInfo 定义请求或响应数据结构。
type SimUserInfoInboundInfo struct {
Head common.TomeeHeader `cmd:"2051" struc:"skip"`
UserId uint32 `fieldDescription:"米米号" uint:"true" codec:"true"`
}
// MoreUserInfoInboundInfo 定义请求或响应数据结构。
type MoreUserInfoInboundInfo struct {
Head common.TomeeHeader `cmd:"2052" struc:"skip"`
UserId uint32 `fieldDescription:"米米号" uint:"true" codec:"true"`
}
// AimatInboundInfo 定义请求或响应数据结构。
type AimatInboundInfo struct {
Head common.TomeeHeader `cmd:"2104" struc:"skip"`
ItemId uint32 `description:"物品id 射击激光 物品id为0" codec:"auto" uint:"true"`
ShootType uint32 `description:"射击类型 未知 给0" codec:"auto" uint:"true"`
Point model.Pos `description:"射击的坐标 x y" codec:"auto"`
}
// ChatInboundInfo 定义请求或响应数据结构。
type ChatInboundInfo struct {
Head common.TomeeHeader `cmd:"2102" struc:"skip"`
Reserve uint32 `json:"reserve" fieldDescription:"填充 默认值为0" uint:"true"`
MessageLen uint32 `struc:"sizeof=Message"`
Message string `json:"message" fieldDescription:"消息内容, 结束符为utf-8的数字0"`
}
// ChangeColorInboundInfo 定义请求或响应数据结构。
type ChangeColorInboundInfo struct {
Head common.TomeeHeader `cmd:"2063" struc:"skip"`
Color uint32 `codec:"color"`
}
// ChangeDoodleInboundInfo 定义请求或响应数据结构。
type ChangeDoodleInboundInfo struct {
Head common.TomeeHeader `cmd:"2062" struc:"skip"`
Id uint32 `codec:"id"`
Color uint32 `codec:"color"`
}
// ChangeNONOColorInboundInfo 定义请求或响应数据结构。
type ChangeNONOColorInboundInfo struct {
Head common.TomeeHeader `cmd:"9012" struc:"skip"`
Color uint32 `codec:"color"`
}
// C2SDanceAction 定义请求或响应数据结构。
type C2SDanceAction struct {
Head common.TomeeHeader `cmd:"2103" struc:"skip"`
Reserve uint32 `struc:"uint32,big"`
Type uint32 `struc:"uint32,big"`
}
// C2SPEOPLE_TRANSFROM 定义请求或响应数据结构。
type C2SPEOPLE_TRANSFROM struct {
Head common.TomeeHeader `cmd:"2111" struc:"skip"`
SuitID uint32 `struc:"uint32,big"`
}
// ChangePlayerNameInboundInfo 定义请求或响应数据结构。
type ChangePlayerNameInboundInfo struct {
Head common.TomeeHeader `cmd:"2061" struc:"skip"`
Nickname string `struc:"[16]byte"`
}
// ChangeTitleInboundInfo 定义请求或响应数据结构。
type ChangeTitleInboundInfo struct {
Head common.TomeeHeader `cmd:"3404" struc:"skip"`
TileID uint32
}
// C2S_GET_GIFT_COMPLETE 定义请求或响应数据结构。
type C2S_GET_GIFT_COMPLETE struct {
Head common.TomeeHeader `cmd:"2801" struc:"skip"`
PassText string `struc:"[16]byte"`
}