Files
bl/logic/service/login/LoginSidInfo.go
昔念 081f990110 refactor(assets): 重构资产同步流程并添加宠物相关功能
- 移除了资产同步到私有 B 仓库的工作流
- 在玩家结构中添加了 IsFighting 字段
- 新增了宠物信息相关功能和数据结构
- 优化了地图进入和怪物刷新逻辑
- 调整了玩家登录和地图数据发送流程
- 重构了部分代码以提高可维护性和性能
2025-08-24 17:33:19 +08:00

74 lines
1.7 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 login
import (
"blazing/common/data/share"
"blazing/common/socket/handler"
"blazing/modules/blazing/model"
"context"
"encoding/hex"
"time"
"github.com/gogf/gf/v2/os/glog"
)
// LoginSidInfo 登录携带的凭证结构体
type InInfo struct { //这里直接使用组合来实现将传入的原始头部数据和结构体参数序列化
Head handler.TomeeHeader `cmd:"1001" struc:"[0]pad"` //玩家登录
Sid []byte `struc:"[16]byte"` // 登录会话ID固定长度16字节
}
func (l *InInfo) CheakSession() bool {
// tt, _ := cool.CacheManager.Keys(context.Background())
//g.Dump(tt)
t1 := hex.EncodeToString(l.Sid)
t, err := share.ShareManager.GetSession(t1)
if err != nil {
return false
}
glog.Debug(context.Background(), "后端获取", t1, t, err)
return t == l.Head.UserID
}
type OutInfo struct {
model.PlayerInfo
}
func NewOutInfo() *OutInfo {
l := &OutInfo{
PlayerInfo: *model.NewPlayerInfo(),
}
t := model.PetInfo{
ID: 300,
Name: [16]byte{'1'},
Dv: 1,
Attack: 1000,
Defence: 1000,
SpecialAttack: 1000,
CatchTime: uint32(time.Now().Unix()),
Speed: 1000,
Hp: 1000,
MaxHp: 1000,
Level: 1,
LvExp: 1000,
NextLvExp: 1000,
Exp: 1000,
//SkillList: [4]model.SkillInfo{{ID: 1, Pp: 1}},
Nature: 1,
Shiny: 1,
}
t.SkillListLen = 1
for i := 0; i < 4; i++ {
t.SkillList[i] = model.SkillInfo{ID: 10001, Pp: 10001}
}
t.EffectInfo = make([]model.PetEffectInfo, 0)
t.EffectInfo = append(t.EffectInfo, model.PetEffectInfo{EffectID: 1, ItemID: 1, LeftCount: 1})
l.PetList = append(l.PetList, t)
return l
}