feat(pet): 实现精灵融合功能并优化相关逻辑

新增精灵融合接口及处理逻辑,支持主副精灵融合生成新精灵,并消耗金币与材料。
同时调整了战斗技能选择流程、修复地图热度统计安全问题以及完善宠物删除机制。

- 添加 `PetFusion` 控制器方法实现融合核心逻辑
- 新增 `C2S_PetFusion` 和 `PetFusionInfo` 结构体用于通信
- 修正战斗中技能随机选取后立即返回的问题
- 修复太空站进入/离开时对地图热度的并发访问风险
-
This commit is contained in:
2025-11-26 01:33:48 +08:00
parent f682abe537
commit f76587f952
14 changed files with 198 additions and 18 deletions

View File

@@ -46,8 +46,10 @@ func (s *Space) LeaveMap(c common.PlayerI) {
s.User.Delete(c.GetInfo().UserID)
s.UserInfo.Delete(c.GetInfo().UserID)
atomic.AddInt32(maphot[s.Super], -1)
_, ok := maphot[s.Super]
if ok {
atomic.AddInt32(maphot[s.Super], -1)
}
}
@@ -59,8 +61,10 @@ func (s *Space) EnterMap(c common.PlayerI) {
s.User.Store(c.GetInfo().UserID, c)
s.UserInfo.Store(c.GetInfo().UserID, *out)
s.Broadcast(c, 2001, out)
atomic.AddInt32(maphot[s.Super], 1)
_, ok := maphot[s.Super]
if ok {
atomic.AddInt32(maphot[s.Super], 1)
}
}
func (s *Space) GetInfo() []maps.OutInfo {

View File

@@ -74,11 +74,11 @@ func GetSpace(id uint32) *Space {
for _, v := range xmlres.MapConfig.Maps {
if v.ID == int(id) { //找到这个地图
// t.Super = uint32(v.Super)
// if t.Super == 0 {
// t.Super = uint32(v.ID)
// }
t.Super = uint32(v.ID)
t.Super = uint32(v.Super)
if t.Super == 0 {
t.Super = uint32(v.ID)
}
_, ok := maphot[t.Super]
if !ok {
var t1 int32