refactor(assets): 重构资产同步流程并添加宠物相关功能
- 移除了资产同步到私有 B 仓库的工作流 - 在玩家结构中添加了 IsFighting 字段 - 新增了宠物信息相关功能和数据结构 - 优化了地图进入和怪物刷新逻辑 - 调整了玩家登录和地图数据发送流程 - 重构了部分代码以提高可维护性和性能
This commit is contained in:
@@ -41,7 +41,10 @@ func (h *Controller) MapEnter(data *maps.InInfo, c *entity.Player) (result *maps
|
||||
return
|
||||
case <-ticker.C:
|
||||
// 刷新当前地图的怪物
|
||||
spawnMonsters(currentMap, c)
|
||||
if !c.IsFighting && c.MapId != 0 {
|
||||
spawnMonsters(currentMap, c)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}(c.StopChan, int(c.MapId))
|
||||
@@ -90,16 +93,19 @@ func spawnMonsters(mapID int, c *entity.Player) {
|
||||
}
|
||||
|
||||
// 创建数据包
|
||||
tt := handler.NewTomeeHeader()
|
||||
tt.CMD = 2004
|
||||
tt.Result = 0
|
||||
tt.UserID = c.UserID
|
||||
tt := handler.NewTomeeHeader(2004, c.UserID)
|
||||
|
||||
// 设置怪物信息
|
||||
t1 := maps.OgreInfo{}
|
||||
//copy(t1.Data[:], monsterConfig) // 使用地图对应的怪物配置
|
||||
for i := 0; i < 9; i++ {
|
||||
t1.Data[i] = mservice.NewMonsterService().GetId(c.MapId)
|
||||
for i := 0; i < 3; i++ {
|
||||
|
||||
ttt := maps.OgrePetInfo{}
|
||||
ttt.Id = mservice.NewMonsterService().GetId(c.MapId)
|
||||
|
||||
ttt.Shiny = uint32(i + 1)
|
||||
//t1.Data[i] = mservice.NewMonsterService().GetId(c.MapId)
|
||||
t1.Data[i] = ttt
|
||||
}
|
||||
// 发送数据包
|
||||
c.SendPack(tt.Pack(&t1))
|
||||
|
||||
Reference in New Issue
Block a user