From c7cdb49a7bd23442a545cd003f0c6d1fde349aee Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Thu, 17 Oct 2024 17:07:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B8=B8=E6=88=8F=E6=9C=8D?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=81=93=E5=85=B7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gamesrv/base/player.go | 1 + model/baginfo.go | 1 + worldsrv/bagmgr.go | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/gamesrv/base/player.go b/gamesrv/base/player.go index 817912f..d6b6113 100644 --- a/gamesrv/base/player.go +++ b/gamesrv/base/player.go @@ -1267,6 +1267,7 @@ func (this *Player) GetSkillAdd(id int32) int32 { // 增加或减少道具 // 同步到 worldsrv func (this *Player) AddItems(args *model.AddItemParam) { + args.IsGame = true changeItem := map[int32]int64{} for _, v := range args.Change { item := srvdata.GameItemMgr.Get(this.Platform, v.ItemId) diff --git a/model/baginfo.go b/model/baginfo.go index a32f549..a47e8de 100644 --- a/model/baginfo.go +++ b/model/baginfo.go @@ -84,6 +84,7 @@ type AddItemParam struct { GameId, GameFreeId int64 // 游戏id,场次id LogId string // 撤销的id,道具兑换失败 RoomConfigId int32 // 房间配置id + IsGame bool // 是否为gamesrv的操作 } type ChangeItemParam struct { diff --git a/worldsrv/bagmgr.go b/worldsrv/bagmgr.go index 2422c0c..9c39a95 100644 --- a/worldsrv/bagmgr.go +++ b/worldsrv/bagmgr.go @@ -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) if err != nil { logger.Logger.Errorf("AddItems Marshal error(%v)", err)