fix 推币机桌面数据校验
This commit is contained in:
parent
f23351de24
commit
e7cce8205a
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue