feat(item): 优化购买金币商品逻辑并完善宠物属性计算

- 购买金币商品时增加失败回滚机制,确保扣除金币与实际获得物品一致
- 使用 `CalculatePetPane` 替代 `Update` 方法以正确刷新宠物面板数据
- 精简地图热度统计逻辑,移除并发安全库依赖,改用普通 map 配合原子操作
- 移除 Space 结构体中冗余的 SuperValue 字段,直接通过 map 统计地图人数
- 更新地图配置文件中的怪物分布信息,调整部分怪物等级和数量配置
```
This commit is contained in:
2025-11-25 21:10:52 +08:00
parent 6455455992
commit f682abe537
8 changed files with 36 additions and 52 deletions

View File

@@ -16,7 +16,7 @@ type Space struct {
UserInfo *csmap.CsMap[uint32, maps.OutInfo]
CanRefresh bool //是否能够刷怪
Super uint32
SuperValue *int32
//SuperValue *int32
//ID uint32 // 地图ID
Name string //地图名称
Owner ARENA
@@ -73,20 +73,20 @@ func GetSpace(id uint32) *Space {
for _, v := range xmlres.MapConfig.Maps {
if v.ID == int(id) { //找到这个地图
t := NewSpace()
t.Super = uint32(v.Super)
ok := maphot.Has(t.Super)
if !ok {
var tt int32 = 0
maphot.Store(uint32(v.Super), &tt)
t.SuperValue = &tt //创建一个
} else {
t.SuperValue, _ = maphot.Load(uint32(v.Super))
// t.Super = uint32(v.Super)
// if t.Super == 0 {
// t.Super = uint32(v.ID)
// }
t.Super = uint32(v.ID)
_, ok := maphot[t.Super]
if !ok {
var t1 int32
maphot[t.Super] = &t1
}
t.Name = v.Name
break
}
}