feat(item): 新增性格道具支持与相关逻辑调整

新增对特定性格道具的支持,包括 Nature 和 NatureSet 属性解析,
并优化精灵融合、任务奖励、战斗捕捉等流程中的宠物添加方式。
同时修复部分战斗逻辑及数据结构引用问题。
This commit is contained in:
2025-12-03 22:05:28 +08:00
parent e694848c0d
commit 8d7d9da0bf
16 changed files with 691 additions and 1105 deletions

View File

@@ -43,7 +43,7 @@ func (c *PetBagController) GetSession(ctx context.Context, req *PetGetReq) (res
t := model.GenPetInfo(
req.PetTypeId, req.IndividualValue, req.NatureId, req.AbilityTypeEnum, req.IsShiny, req.Level)
service.NewUserService(uint32(admin.UserId)).Pet.PetAdd(*t)
service.NewUserService(uint32(admin.UserId)).Pet.PetAdd(t)
return
}

View File

@@ -77,7 +77,8 @@ type PetInfo struct {
SkillList []SkillInfo
// 捕捉时间(@UInt long → 若为时间戳用uint32若需时间类型可改为time.Time需配合序列化处理
CatchTime uint32 //`json:"-"` // 显式忽略,不参与序列化
CatchTime uint32 //`json:"-"` // 显式忽略,不参与序列化
OldCatchTime uint32 `struc:"skip" fieldDesc:"旧捕捉时间" `
// 捕捉地图(@UInt long → uint32
CatchMap uint32 `fieldDesc:"捕捉地图" `
@@ -295,6 +296,7 @@ func calculateExperience(level uint32, baseValue uint32) uint32 {
type PetEffectInfo struct {
ItemID uint32 `struc:"uint32" json:"item_id"` //如果是能量珠,就显示
Idx uint16 `struc:"skip" json:"new_se_idx"`
Type byte `struc:"skip" json:"type"` //pvp pve特性区分,待前端修改实现
Status byte `struc:"byte" json:"status"` //特性为1,能量珠为2
LeftCount byte `struc:"byte" json:"left_count"` //剩余次数
EID uint16 `struc:"uint16" json:"effect_id"` //特效ID

View File

@@ -55,13 +55,13 @@ func (s *PetService) Pet_del(cachetime uint32) {
cool.DBM(s.Model).Where("player_id", s.userid).Where("catch_time", cachetime).Delete()
}
func (s *PetService) PetAdd(y model.PetInfo) {
func (s *PetService) PetAdd(y *model.PetInfo) {
for {
m1 := cool.DBM(s.Model).Where("player_id", s.userid)
var player model.PetEX
player.PlayerID = s.userid
player.Data = y
player.Data = *y
player.CatchTime = y.CatchTime
player.Free = 0