feat(pet): 实现精灵融合功能并优化相关逻辑
新增精灵融合接口及处理逻辑,支持主副精灵融合生成新精灵,并消耗金币与材料。 同时调整了战斗技能选择流程、修复地图热度统计安全问题以及完善宠物删除机制。 - 添加 `PetFusion` 控制器方法实现融合核心逻辑 - 新增 `C2S_PetFusion` 和 `PetFusionInfo` 结构体用于通信 - 修正战斗中技能随机选取后立即返回的问题 - 修复太空站进入/离开时对地图热度的并发访问风险 -
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user