diff --git a/base/codes/code.go b/base/codes/code.go index 56e9783..991fb67 100644 --- a/base/codes/code.go +++ b/base/codes/code.go @@ -20,7 +20,7 @@ var ( IllegalRequest = NewCode(9, "illegal request") InvalidPhone = NewCode(10, "invalid phone number") GoldIsNot = NewCode(11, "invalid Gold number") - InsufficientGold = NewCode(12, "Insufficient gold") + IsMaxBetMultiple = NewCode(12, "Max Bet Multiple") InsufficientDiamond = NewCode(13, "Insufficient diamond") NotFoundBankCard = NewCode(14, "not found bank card") ErrorJoinRoom = NewCode(15, "join room error") diff --git a/game-server/game/dragonTiger/app/logic/player.go b/game-server/game/dragonTiger/app/logic/player.go index 3876fb0..06aad85 100644 --- a/game-server/game/dragonTiger/app/logic/player.go +++ b/game-server/game/dragonTiger/app/logic/player.go @@ -100,6 +100,7 @@ func (p *Player) settlement(winRegion proto.BetRegion, table *Table) (total int6 var betTotal int64 //总下注 var betWin int64 //赢区下注 var win int64 + var lose int64 // 计算输赢 for region, value := range p.CurrBets { betTotal += value @@ -120,6 +121,8 @@ func (p *Player) settlement(winRegion proto.BetRegion, table *Table) (total int6 default: break } + } else { + lose += value } } // 没有投注 @@ -145,7 +148,7 @@ func (p *Player) settlement(winRegion proto.BetRegion, table *Table) (total int6 // 计算输赢 var rate int64 = 0 rate = int64(float64(win) * table.Conf.RoomRate) - total = win + betWin - betTotal - rate + total = win + betWin - lose - rate //开奖结果为和,退还龙虎区域的下注额 returnBet := int64(0) if winRegion == proto.BetRegion_Draw { @@ -155,7 +158,7 @@ func (p *Player) settlement(winRegion proto.BetRegion, table *Table) (total int6 if !p.IsRobot { // 保存游戏记录 p.saveGameRecord(betWin, betTotal, win, rate, returnBet, table) - log.Info("结算数据:", p.SeatId, betTotal, win, rate) + //log.Info("结算数据:", p.SeatId, betTotal, win, rate) } p.CurrBets = make(map[proto.BetRegion]int64) @@ -172,7 +175,7 @@ func (p *Player) saveGameRecord(betWin, betTotal, win, rate, returnBet int64, t p.BeforeBalance = p.Gold + betTotal total := win + betWin - betTotal - rate - + userWin := win + betWin - betTotal //玩家输赢不扣明水 //var darkValue int64 //暗水 //var stockValue int64 //库存变动值 @@ -188,7 +191,7 @@ func (p *Player) saveGameRecord(betWin, betTotal, win, rate, returnBet int64, t stockRecord.RoomNormalWin = total } - stockValue := -(win + betWin - betTotal) - darkValue + stockValue := (win + betWin - betTotal) + darkValue CheatValueChange := stockValue //点控值 stockRecord.LightWater = rate @@ -257,7 +260,8 @@ func (p *Player) saveGameRecord(betWin, betTotal, win, rate, returnBet int64, t } else { CheatValue = 0 - rpc_client.ModifyGameBloodOfStockNumArgs(p.Ctx.Proxy, t.BloodId, stockValue) // + log.Infof("修改血池库存,id:%v,值:%v", t.BloodId, stockValue) + rpc_client.ModifyGameBloodOfStockNumArgs(p.Ctx.Proxy, t.BloodId, stockValue) } // 库存记录 @@ -292,6 +296,7 @@ func (p *Player) saveGameRecord(betWin, betTotal, win, rate, returnBet int64, t stockRecord.StockConfig = t.StockConf stockRecord.StockId = t.StockId stockRecord.Stock = t.Stock + //log.Infof("更新血池库存记录前,Stock:%v", t.Stock) stockRecord.CurrentRoomNum = int32(t.PlayerCount) //血池库存记录 @@ -309,7 +314,7 @@ func (p *Player) saveGameRecord(betWin, betTotal, win, rate, returnBet int64, t Field: strconv.FormatInt(t.Id, 10), //场次 TaxRate: float32(t.Conf.RoomRate), //税率 BetAmount: betTotal, //下注总额 - WinAmount: total, //盈利 + WinAmount: userWin, //盈利 TaxAmount: rate, //税收 输了没有税收 PlayerBetTotal: betTotal, //玩家总下注额 BeforeBalance: p.BeforeBalance, diff --git a/game-server/game/service/rpc_client/rpc_game.go b/game-server/game/service/rpc_client/rpc_game.go index 5f39c62..9110139 100644 --- a/game-server/game/service/rpc_client/rpc_game.go +++ b/game-server/game/service/rpc_client/rpc_game.go @@ -160,6 +160,7 @@ func InertGameControlRecord(ctx *node.Proxy, UserId, CheatType, CheatValue int64 GameId: GameId, RoomId: RoomId, AgentId: AgentId, + //BetAmount: }) if err != nil { return err @@ -185,11 +186,12 @@ func UpdateGameControlCheatValue(ctx *node.Proxy, UserId, CheatValue int64) erro // 添加血池库存变动记录 func GameRecordBloodStock(param *dao.GameResultCalculate, stockValue int64) error { + log.Infof("添加血池库存变动记录,Stock:%v,stockValue:%v", param.Stock, stockValue) stockAfter := int64(0) if param.IsPoint == true { stockAfter = param.Stock } else { - stockAfter = param.Stock + stockValue + stockAfter = param.Stock - stockValue } res := &dao.GameRecordBloodStock{ UserId: param.UID, @@ -270,7 +272,7 @@ func PushGameResultCalculate(param *dao.GameResultCalculate) (*constant.GameReco // 明水 var brightValue int64 = int64(float64(param.BetTotal) * float64(param.BrightRate)) total := int64(0) - + userWin := int64(0) //玩家输赢不扣明水 // 点控值 CheatValueChange := int64(0) @@ -281,13 +283,14 @@ func PushGameResultCalculate(param *dao.GameResultCalculate) (*constant.GameReco darkValue = int64(float64(param.BetTotal) * float64(param.DarkRate)) // 玩家赢了的获取值 total = param.BetTotal - brightValue - param.BetAmount //赢的数字 + userWin = param.BetTotal - param.BetAmount param.LightWater = brightValue param.DarkWater = darkValue //血池白名单,输赢不影响血池(库存,暗水) CheatValueChange = param.BetTotal - param.BetAmount // 库存变动值 --- 赢了 - stockValue = param.BetTotal + darkValue - param.BetAmount + stockValue = param.BetTotal - param.BetAmount + darkValue if isInWhiteList { CheatValueChange = 0 @@ -312,6 +315,7 @@ func PushGameResultCalculate(param *dao.GameResultCalculate) (*constant.GameReco darkValue = int64(float64(param.BetAmount) * float64(param.DarkRate)) // 玩家输了的获取值 total = -param.BetAmount //输的数字 + userWin = -param.BetAmount param.LightWater = 0 param.DarkWater = darkValue // 明水暗水 @@ -391,7 +395,7 @@ func PushGameResultCalculate(param *dao.GameResultCalculate) (*constant.GameReco Field: param.RoomName, //场次 TaxRate: float32(param.BrightRate), //税率 BetAmount: param.BetTotal, //下注总额 - WinAmount: total, //盈利 + WinAmount: userWin, //盈利 TaxAmount: param.LightWater, //税收 输了没有税收 PlayerBetTotal: param.PlayerBetTotal, //玩家总下注额 BeforeBalance: param.BeforeBalance, diff --git a/game-server/game/thirdgame/app/logic/roomBehavior.go b/game-server/game/thirdgame/app/logic/roomBehavior.go index 2f2dac8..0861375 100644 --- a/game-server/game/thirdgame/app/logic/roomBehavior.go +++ b/game-server/game/thirdgame/app/logic/roomBehavior.go @@ -233,7 +233,6 @@ func (b *RoomBehavior) ReqApplyBiPai(ctx *node.Context) { time.Sleep(time.Millisecond * time.Duration(intervalTime)) } isAgree := other.AIIsAgreeCompareCard() - isAgree = false if isAgree { //同意比牌 AgreeTime := tools.GetRandomRange(2, int32(tools.StrToInt64(b.room.Global.RoundTime)/2)) @@ -652,9 +651,12 @@ func (b *RoomBehavior) GenZhu(player *Player) bool { betValue = b.room.CurrentBet * 2 } - if b.room.Opt.MaxBetAsset < betValue { + curBetMultiple := b.room.CurrentBet / (b.room.Opt.MinBetAsset) + MaxBetMultiple := tools.StrToFloat64(b.room.Global.MaxBetMultiple) + IsMaxBetMultiple := float64(curBetMultiple) > MaxBetMultiple + if IsMaxBetMultiple { if !player.IsAI() { - b.room.Send(route.Bet, &constant.BaseResponse{Code: codes.GoldIsNot.Code(), Msg: "最大下注限制"}) + b.room.Send(route.Bet, &constant.BaseResponse{Code: codes.IsMaxBetMultiple.Code(), Msg: "最大下注限制"}) } }