修复游戏服同步道具问题

This commit is contained in:
sk 2024-10-17 17:07:41 +08:00
parent 5ee2dd9eac
commit c7cdb49a7b
3 changed files with 3 additions and 1 deletions

View File

@ -1267,6 +1267,7 @@ func (this *Player) GetSkillAdd(id int32) int32 {
// 增加或减少道具 // 增加或减少道具
// 同步到 worldsrv // 同步到 worldsrv
func (this *Player) AddItems(args *model.AddItemParam) { func (this *Player) AddItems(args *model.AddItemParam) {
args.IsGame = true
changeItem := map[int32]int64{} changeItem := map[int32]int64{}
for _, v := range args.Change { for _, v := range args.Change {
item := srvdata.GameItemMgr.Get(this.Platform, v.ItemId) item := srvdata.GameItemMgr.Get(this.Platform, v.ItemId)

View File

@ -84,6 +84,7 @@ type AddItemParam struct {
GameId, GameFreeId int64 // 游戏id,场次id GameId, GameFreeId int64 // 游戏id,场次id
LogId string // 撤销的id,道具兑换失败 LogId string // 撤销的id,道具兑换失败
RoomConfigId int32 // 房间配置id RoomConfigId int32 // 房间配置id
IsGame bool // 是否为gamesrv的操作
} }
type ChangeItemParam struct { type ChangeItemParam struct {

View File

@ -729,7 +729,7 @@ func (this *BagMgr) AddItems(param *model.AddItemParam) (*BagInfo, bag.OpResultC
} }
// 同步游戏服务器 // 同步游戏服务器
if p.scene != nil { if p.scene != nil && !param.IsGame {
b, err := netlib.Gob.Marshal(items) b, err := netlib.Gob.Marshal(items)
if err != nil { if err != nil {
logger.Logger.Errorf("AddItems Marshal error(%v)", err) logger.Logger.Errorf("AddItems Marshal error(%v)", err)