From e7cce8205a3512fc37b40f6c0e2ae2072af1326e Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Tue, 14 Jan 2025 10:13:25 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=8E=A8=E5=B8=81=E6=9C=BA=E6=A1=8C?= =?UTF-8?q?=E9=9D=A2=E6=95=B0=E6=8D=AE=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worldsrv/action_pushcoin.go | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/worldsrv/action_pushcoin.go b/worldsrv/action_pushcoin.go index f6a9284..1e594d8 100644 --- a/worldsrv/action_pushcoin.go +++ b/worldsrv/action_pushcoin.go @@ -177,20 +177,21 @@ func CSPushCoinPlayerOp(s *netlib.Session, packetid int, data interface{}, sid i // 有效区 for _, v := range msg.GetOpItem() { id := v.GetItemId() - val := int64(v.GetItemNum()) - switch v.GetItemId() { - case common.ItemIDBigCoin, common.ItemIDCoin1, common.ItemIDCoin2, common.ItemIDCoin3: - val *= srvdata.GameItemMgr.Get(p.Platform, id).GetNum() - id = common.ItemIDCoin - } + val := v.GetItemNum() if p.WelfData.PushCoin.Items[id] < val { logger.Logger.Errorf("获得道具太多: %d, %d", p.WelfData.PushCoin.Items[id], val) // 刷新桌面余额 - UpdatePlayerPushCoin(p) + //UpdatePlayerPushCoin(p) goto here } + switch v.GetItemId() { + case common.ItemIDBigCoin, common.ItemIDCoin1, common.ItemIDCoin2, common.ItemIDCoin3: + val *= srvdata.GameItemMgr.Get(p.Platform, id).GetNum() + id = common.ItemIDCoin + } + BagMgrSingleton.AddItems(&model.AddItemParam{ Platform: p.Platform, SnId: p.SnId, @@ -220,11 +221,11 @@ func CSPushCoinPlayerOp(s *netlib.Session, packetid int, data interface{}, sid i p.WelfData.PushCoin.Shake -= int32(msg.GetOpParam()) case activity.OpCodes_OP_Refresh: - if p.WelfData.PushCoin.Refresh <= 0 { - InitPlayerPushCoin(p) - } else { - UpdatePlayerPushCoin(p) - } + //if p.WelfData.PushCoin.Refresh <= 0 { + // InitPlayerPushCoin(p) + //} else { + // UpdatePlayerPushCoin(p) + //} case activity.OpCodes_OP_Exchange: d := srvdata.PBDB_PropExchangeMgr.GetData(int32(msg.GetOpParam())) @@ -319,7 +320,7 @@ func InitPlayerPushCoin(p *Player) { Exchange: make(map[int32]int32), Items: map[int32]int64{ common.ItemIDVCard: 1, - common.ItemIDCoin: 50 * 5000, + common.ItemIDCoin1: 50, common.ItemIDPlum: 1, }, } @@ -329,7 +330,7 @@ func UpdatePlayerPushCoin(p *Player) { p.WelfData.PushCoin.Refresh++ // 50个金币 p.WelfData.PushCoin.Items = map[int32]int64{ - common.ItemIDCoin: 50 * 5000, + common.ItemIDCoin1: 50, } } @@ -429,8 +430,6 @@ func PushCoinAddValue(p *Player, item map[int32]int64) { for k, v := range item { if v > 0 { switch k { - case common.ItemIDCoin1, common.ItemIDCoin2, common.ItemIDCoin3, common.ItemIDBigCoin: - p.WelfData.PushCoin.Items[common.ItemIDCoin] += v * srvdata.GameItemMgr.Get(p.Platform, k).GetNum() default: p.WelfData.PushCoin.Items[k] += v }