```
fix(socket): 修复TCP连接处理中逻辑取反错误 修复了`handleTcp`函数中对`s.discorse`的判断条件错误,导致CORS配置未正确应用的问题。 feat(player): 增加地图切换标记支持 在`Player`结构体中新增`Changemap`字段,用于标识玩家是否切换过地图,并在相关业务逻辑中进行设置和判断。 feat(pet): 重构精灵生成与经验处理逻辑 将`GenPetInfo`方法从model包迁移至player包,增加个体值、性格、特性等随机生成逻辑,优化技能学习处理方式。 refactor(service): 优化定时任务与连接管理 使用`cool.Cron`替代原生ticker实现刷怪定时任务,优化连接获取方式,确保并发安全。 refactor(model): 移除冗余代码并优化结构 从`pet.go`中移除已迁移至`player`包的函数定义,精简模型结构,提升模块清晰度。 refactor(config): 更新部门及字典名称配置 将`base_sys_department.json`和
This commit is contained in:
@@ -27,7 +27,7 @@ func (h Controller) PlayerFightBoss(data *fight.ChallengeBossInboundInfo, c *pla
|
||||
petid = 7
|
||||
}
|
||||
|
||||
mo = model.GenPetInfo(
|
||||
mo = c.GenPetInfo(
|
||||
int(petid), 24, //24个体
|
||||
-1,
|
||||
0, //野怪没特性
|
||||
@@ -55,7 +55,7 @@ func (h Controller) OnPlayerFightNpcMonster(data *fight.FightNpcMonsterInboundIn
|
||||
|
||||
return nil, errorcode.ErrorCodes.ErrPokemonNotExists
|
||||
}
|
||||
mo := model.GenPetInfo(
|
||||
mo := c.GenPetInfo(
|
||||
int(refpet.Id), -1,
|
||||
-1,
|
||||
0, //野怪没特性
|
||||
|
||||
@@ -39,6 +39,7 @@ func (h *Controller) Login(data *user.MAIN_LOGIN_IN, c *player.Conn) (result *us
|
||||
t.Info = t.Service.Person(data.Head.UserID)
|
||||
t.Info.UserID = data.Head.UserID
|
||||
t.Onlinetime = uint32(time.Now().Unix()) //保存时间戳
|
||||
t.Changemap = true
|
||||
|
||||
share.ShareManager.SetUserOnline(data.Head.UserID, h.Port) //设置用户登录服务器
|
||||
|
||||
|
||||
@@ -36,7 +36,8 @@ func (h Controller) MapHot(data *maphot.InInfo, c *player.Player) (result *mapho
|
||||
}
|
||||
func (h *Controller) MapLeave(data *maps.LeaveMapInboundInfo, c *player.Player) (result *space.LeaveMapOutboundInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
|
||||
//result = &maps.LeaveMapOutboundInfo{UserID: c.GetUserID()}
|
||||
c.Canmon = false //可以刷怪
|
||||
c.Canmon = false
|
||||
c.Changemap = true //可以刷怪
|
||||
data.Broadcast(c.Info.MapID, space.LeaveMapOutboundInfo{UserID: c.Info.UserID}) //同步广播
|
||||
space.GetSpace(c.Info.MapID).User.Remove(c.Info.UserID)
|
||||
// 如果有正在运行的刷怪协程,发送停止信号
|
||||
|
||||
@@ -48,7 +48,7 @@ func (h *Controller) GetPetList(
|
||||
result.ShortInfoList = make([]pet.PetShortInfo, len(tt))
|
||||
for i, v := range tt {
|
||||
|
||||
copier.Copy(&result.ShortInfoList[i], &v)
|
||||
copier.Copy(&result.ShortInfoList[i], &v.Data)
|
||||
|
||||
}
|
||||
return result, 0
|
||||
|
||||
Reference in New Issue
Block a user