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:
2025-10-13 18:51:41 +08:00
parent b258a81bb8
commit 79213c67d6
23 changed files with 268 additions and 175 deletions

View File

@@ -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)
// 如果有正在运行的刷怪协程,发送停止信号