feat(login): 初始化玩家登录信息中的 Nonono

This commit is contained in:
2025-10-20 00:23:16 +08:00
parent e12155f86f
commit d673ee4776
9 changed files with 124 additions and 67 deletions

View File

@@ -87,7 +87,11 @@ func (h *Controller) Login(data *user.MAIN_LOGIN_IN, c gnet.Conn) (result *user.
result = user.NewOutInfo() //设置登录消息
result.PlayerInfo = *t.Info
for i := 0; i < 80; i++ {
result.PlayerInfo.NonoChipList[i] = 255
}
result.NONO.SuperNono = 1
defer func() {
tt := maps.NewOutInfo()
copier.CopyWithOption(tt, t.Info, copier.Option{DeepCopy: true})

View File

@@ -1,24 +0,0 @@
package controller
import (
"blazing/common/socket/errorcode"
"blazing/logic/service/nono"
"github.com/panjf2000/gnet/v2"
)
// 处理命令: 105
func (h *Controller) NonoFollowOrHome(data *nono.NonoFollowOrHomeInInfo, c gnet.Conn) (result *nono.NonoFollowOutInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
result = &nono.NonoFollowOutInfo{
data.Head.UserID,
data.Flag,
data.Flag,
"",
0,
0,
}
return
}

51
logic/controller/nono.go Normal file
View File

@@ -0,0 +1,51 @@
package controller
import (
"blazing/common/socket/errorcode"
"blazing/logic/service/nono"
"blazing/logic/service/player"
"github.com/jinzhu/copier"
)
// 处理命令: 105
func (h *Controller) NonoFollowOrHome(data *nono.NonoFollowOrHomeInInfo, c *player.Player) (result *nono.NonoFollowOutInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
c.Info.NONO.Flag = data.Flag
result = &nono.NonoFollowOutInfo{
data.Head.UserID,
data.Flag,
data.Flag,
"",
0,
0,
}
return
}
// 获取nono信息
func (h *Controller) GetNonoInfo(data *nono.NonoInboundInfo, c *player.Player) (result *nono.NonoOutboundInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
result = &nono.NonoOutboundInfo{}
copier.Copy(result, &c.Info.NONO)
result.UserID = c.Info.UserID
for i := 0; i < 20; i++ {
result.Func[i] = 255
}
result.Num = 1
result.SuperNono = 1
result.SuperLevel = 12
return
}
func (h *Controller) SwitchFlying(data *nono.SwitchFlyingInboundInfo, c *player.Player) (result *nono.SwitchFlyingOutboundInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
result = &nono.SwitchFlyingOutboundInfo{
data.Head.UserID,
data.Type,
}
return
}

BIN
logic/logic1 Normal file

Binary file not shown.

View File

@@ -77,7 +77,7 @@ type NonoFollowOutInfo struct {
Flag uint32 `fieldDescription:"1为跟随 0为收回 且如果为收回 那么后续结构不需要发送, 不序列化" uint:"true" serialize:"false"`
// NonoNick nono名字 补到16字节
NonoNick string `struc:"[16]byte"`
Nick string `struc:"[16]byte"`
// Color nono颜色 rpg改为uint32
Color uint32 `fieldDescription:"nono颜色 rpg" uint:"true"`
@@ -85,3 +85,11 @@ type NonoFollowOutInfo struct {
// Power 能量值 前端显示除以1000后的值改为uint32
Power uint32 `fieldDescription:"能量值 前端显示除以1000后的值" uint:"true"`
}
type SwitchFlyingInboundInfo struct {
Head player.TomeeHeader `cmd:"2112" struc:"[0]pad"`
Type uint32 `description:"开关, 0为取消飞行模式, 大于0为开启飞行模式" codec:"auto" uint:"true"` // 对应@FieldDescription、@UInt、@AutoCodec
} // SwitchFlyingOutboundInfo 对应Java的SwitchFlyingOutboundInfo类
type SwitchFlyingOutboundInfo struct {
UserId uint32 `description:"玩家账号ID" codec:"auto" uint:"true"` // 对应@FieldDescription、@UInt、@AutoCodec
Type uint32 `description:"开关, 0为取消飞行模式, 大于0为开启飞行模式" codec:"auto" uint:"true"` // 对应@FieldDescription、@UInt、@AutoCodec
}

View File

@@ -25,11 +25,6 @@ type PetEX struct {
Data PetInfo `orm:"data" json:"data"`
}
type PetS struct {
Pet
Data []PetInfo `orm:"data" dc:"资源规格"`
}
// PetInfo 精灵信息结构(合并后的优化版本)
type PetInfo struct {

View File

@@ -91,42 +91,49 @@ type PlayerInfo struct {
GraduationCount uint32 `struc:"uint32" default:"0" json:"graduation_count"` // 毕业人数
}
MaxPuniLv uint32 `struc:"uint32" default:"0" json:"max_puni_lv"` // 默认0, 虚无 元素 能量 生命 轮回 永恒 圣洁 最高为8
PetMaxLevel uint32 `struc:"uint32" json:"pet_max_level"` // 精灵最高等级
AllPetNumber uint32 `struc:"uint32" json:"all_pet_number"` // 精灵数量
MonKingWin uint32 `struc:"uint32" json:"mon_king_win"` // 精灵王胜场
CurrentStage uint32 `struc:"uint32" json:"current_stage"` // 勇者之塔层数
MaxStage uint32 `struc:"uint32" json:"max_stage"` // 试炼之塔最高层
CurrentFreshStage uint32 `struc:"uint32" json:"current_fresh_stage"` // 当前试炼层数
MaxFreshStage uint32 `struc:"uint32" json:"max_fresh_stage"` // 最高试炼层
MaxArenaWins uint32 `struc:"uint32" json:"max_arena_wins"` // 星际擂台连胜
TwoTimes uint32 `struc:"uint32" default:"0" json:"two_times"` // 双倍经验加速器剩余使用次数
ThreeTimes uint32 `struc:"uint32" default:"0" json:"three_times"` // 三倍经验加速器剩余使用次数
AutoFight uint32 `struc:"uint32" default:"0" json:"auto_fight"` // 是否自动战斗
AutoFightTime uint32 `struc:"uint32" default:"0" json:"auto_fight_time"` // 自动战斗剩余的场次
EnergyTime uint32 `struc:"uint32" default:"0" json:"energy_time"` // 能量吸收仪剩余次数
LearnTimes uint32 `struc:"uint32" default:"0" json:"learn_times"` // 学习力吸收仪剩余次数
MonBattleMedal uint32 `struc:"uint32" default:"0" json:"mon_battle_medal"` // 默认0
RecordCount uint32 `struc:"uint32" default:"0" json:"record_count"` // 默认0
ObtainTm uint32 `struc:"uint32" default:"0" json:"obtain_tm"` // 默认0
SoulBeadItemID uint32 `struc:"uint32" json:"soul_bead_item_id"` // 当前元神珠id
ExpireTm uint32 `struc:"uint32" default:"0" json:"expire_tm"` // 默认0
FuseTimes uint32 `struc:"uint32" default:"0" json:"fuse_times"` // 默认0
HasNono uint32 `struc:"uint32" default:"1" json:"has_nono"` // 玩家是否有nono
SuperNono uint32 `struc:"uint32" default:"1" json:"super_nono"` // 玩家是否有超能nono
NonoState uint32 `struc:"uint32" default:"4294967295" json:"nono_state"` // 默认-1
NonoColor uint32 `struc:"uint32" json:"nono_color"` // nono颜色
NonoNick string `struc:"[16]byte" default:"nono" json:"nono_nick"` // nono名字16字节
TeamInfo TeamInfo `struc:"struct" json:"team_info"` // 战队信息24字节
TeamPkInfo TeamPKInfo `struc:"struct" json:"team_pk_info"` // 8字节
Reserved byte `struc:"byte" json:"reserved"` // 1字节无内容
Badge uint32 `struc:"uint32" default:"0" json:"badge"` // 默认0
Reserved1 [27]byte `struc:"[27]byte" default:"3" json:"reserved1"` // 27字节默认3
TaskList [500]byte `struc:"[500]byte" default:"0" json:"task_list"` // 任务状态数组500字节默认3
PetListCount uint32 `struc:"sizeof=PetList" json:"pet_list_count"` // 精灵列表长度
PetList []PetInfo ` json:"pet_list"` // 精灵背包内信息
ClothesCount uint32 `struc:"sizeof=Clothes" json:"clothes_count"` // 穿戴装备数量
Clothes []PeopleItemInfo ` json:"clothes"` // 穿戴装备
MaxPuniLv uint32 `struc:"uint32" default:"0" json:"max_puni_lv"` // 默认0, 虚无 元素 能量 生命 轮回 永恒 圣洁 最高为8
PetMaxLevel uint32 `struc:"uint32" json:"pet_max_level"` // 精灵最高等级
AllPetNumber uint32 `struc:"uint32" json:"all_pet_number"` // 精灵数量
MonKingWin uint32 `struc:"uint32" json:"mon_king_win"` // 精灵王胜场
CurrentStage uint32 `struc:"uint32" json:"current_stage"` // 勇者之塔层数
MaxStage uint32 `struc:"uint32" json:"max_stage"` // 试炼之塔最高层
CurrentFreshStage uint32 `struc:"uint32" json:"current_fresh_stage"` // 当前试炼层数
MaxFreshStage uint32 `struc:"uint32" json:"max_fresh_stage"` // 最高试炼层
MaxArenaWins uint32 `struc:"uint32" json:"max_arena_wins"` // 星际擂台连胜
TwoTimes uint32 `struc:"uint32" default:"0" json:"two_times"` // 双倍经验加速器剩余使用次数
ThreeTimes uint32 `struc:"uint32" default:"0" json:"three_times"` // 三倍经验加速器剩余使用次数
AutoFight uint32 `struc:"uint32" default:"0" json:"auto_fight"` // 是否自动战斗
AutoFightTime uint32 `struc:"uint32" default:"0" json:"auto_fight_time"` // 自动战斗剩余的场次
EnergyTime uint32 `struc:"uint32" default:"0" json:"energy_time"` // 能量吸收仪剩余次数
LearnTimes uint32 `struc:"uint32" default:"0" json:"learn_times"` // 学习力吸收仪剩余次数
MonBattleMedal uint32 `struc:"uint32" default:"0" json:"mon_battle_medal"` // 默认0
RecordCount uint32 `struc:"uint32" default:"0" json:"record_count"` // 默认0
ObtainTm uint32 `struc:"uint32" default:"0" json:"obtain_tm"` // 默认0
SoulBeadItemID uint32 `struc:"uint32" json:"soul_bead_item_id"` // 当前元神珠id
ExpireTm uint32 `struc:"uint32" default:"0" json:"expire_tm"` // 默认0
FuseTimes uint32 `struc:"uint32" default:"0" json:"fuse_times"` // 默认0
NONO struct {
//fieldDescription:"1为跟随 0为收回 且如果为收回 那么后续结构不需要发送, 不序列化"
Flag uint32 `struc:"skip" json:"nono_flag"`
HasNono uint32 `struc:"uint32" default:"1" json:"has_nono"` // 玩家是否有nono
SuperNono uint32 `struc:"uint32" default:"1" json:"super_nono"` // 玩家是否有超能nono
NonoState uint32 `struc:"uint32" default:"4294967295" json:"nono_state"` // 默认-1
Color uint32 `struc:"uint32" json:"nono_color"` // nono颜色
Nick string `struc:"[16]byte" default:"nono" json:"nono_nick"` // nono名字16字节
}
TeamInfo TeamInfo `struc:"struct" json:"team_info"` // 战队信息24字节
TeamPkInfo TeamPKInfo `struc:"struct" json:"team_pk_info"` // 8字节
Reserved byte `struc:"byte" json:"reserved"` // 1字节无内容
Badge uint32 `struc:"uint32" default:"0" json:"badge"` // 默认0
Reserved1 [27]byte `struc:"[27]byte" default:"3" json:"reserved1"` // 27字节默认3
TaskList [500]byte `struc:"[500]byte" default:"0" json:"task_list"` // 任务状态数组500字节默认3
PetListCount uint32 `struc:"sizeof=PetList" json:"pet_list_count"` // 精灵列表长度
PetList []PetInfo ` json:"pet_list"` // 精灵背包内信息
ClothesCount uint32 `struc:"sizeof=Clothes" json:"clothes_count"` // 穿戴装备数量
Clothes []PeopleItemInfo ` json:"clothes"` // 穿戴装备
}
// TableName PlayerInfo's table name

View File

@@ -52,7 +52,7 @@ func (s *UserService) Reg(nick string, color uint32) {
func (s *UserService) Person(userid uint32) *model.PlayerInfo {
m := s.Model(s.info.Model)
m := cool.DBM(s.info.Model).Where("player_id", userid)
var tt model.PlayerEX
err := m.Scan(&tt)
if err != nil {

View File

@@ -4,6 +4,9 @@ import (
"blazing/cool"
"blazing/modules/blazing/model"
"context"
"fmt"
"github.com/gogf/gf/v2/util/gconv"
)
// 获取精灵信息 0是仓库,1是背包,2是放生
@@ -51,6 +54,19 @@ func (s *UserService) PetAdd(y model.PetInfo) {
}
}
func (s *PetService) ModifyBefore(ctx context.Context, method string, param map[string]interface{}) (err error) {
if method == "Update" {
admin := cool.GetAdmin(ctx)
userId := admin.UserId
if userId != gconv.Uint(param["player_id"]) {
err = fmt.Errorf("修改失败")
}
}
return
}
type PetService struct {
*cool.Service