Browse Source

3part 龙虎 问题修改

dev
wchongy99 9 months ago
parent
commit
f97a57f0cc
  1. 2
      base/codes/code.go
  2. 17
      game-server/game/dragonTiger/app/logic/player.go
  3. 12
      game-server/game/service/rpc_client/rpc_game.go
  4. 8
      game-server/game/thirdgame/app/logic/roomBehavior.go

2
base/codes/code.go

@ -20,7 +20,7 @@ var (
IllegalRequest = NewCode(9, "illegal request") IllegalRequest = NewCode(9, "illegal request")
InvalidPhone = NewCode(10, "invalid phone number") InvalidPhone = NewCode(10, "invalid phone number")
GoldIsNot = NewCode(11, "invalid Gold number") GoldIsNot = NewCode(11, "invalid Gold number")
InsufficientGold = NewCode(12, "Insufficient gold") IsMaxBetMultiple = NewCode(12, "Max Bet Multiple")
InsufficientDiamond = NewCode(13, "Insufficient diamond") InsufficientDiamond = NewCode(13, "Insufficient diamond")
NotFoundBankCard = NewCode(14, "not found bank card") NotFoundBankCard = NewCode(14, "not found bank card")
ErrorJoinRoom = NewCode(15, "join room error") ErrorJoinRoom = NewCode(15, "join room error")

17
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 betTotal int64 //总下注
var betWin int64 //赢区下注 var betWin int64 //赢区下注
var win int64 var win int64
var lose int64
// 计算输赢 // 计算输赢
for region, value := range p.CurrBets { for region, value := range p.CurrBets {
betTotal += value betTotal += value
@ -120,6 +121,8 @@ func (p *Player) settlement(winRegion proto.BetRegion, table *Table) (total int6
default: default:
break break
} }
} else {
lose += value
} }
} }
// 没有投注 // 没有投注
@ -145,7 +148,7 @@ func (p *Player) settlement(winRegion proto.BetRegion, table *Table) (total int6
// 计算输赢 // 计算输赢
var rate int64 = 0 var rate int64 = 0
rate = int64(float64(win) * table.Conf.RoomRate) rate = int64(float64(win) * table.Conf.RoomRate)
total = win + betWin - betTotal - rate total = win + betWin - lose - rate
//开奖结果为和,退还龙虎区域的下注额 //开奖结果为和,退还龙虎区域的下注额
returnBet := int64(0) returnBet := int64(0)
if winRegion == proto.BetRegion_Draw { if winRegion == proto.BetRegion_Draw {
@ -155,7 +158,7 @@ func (p *Player) settlement(winRegion proto.BetRegion, table *Table) (total int6
if !p.IsRobot { if !p.IsRobot {
// 保存游戏记录 // 保存游戏记录
p.saveGameRecord(betWin, betTotal, win, rate, returnBet, table) 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) 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 p.BeforeBalance = p.Gold + betTotal
total := win + betWin - betTotal - rate total := win + betWin - betTotal - rate
userWin := win + betWin - betTotal //玩家输赢不扣明水
//var darkValue int64 //暗水 //var darkValue int64 //暗水
//var stockValue int64 //库存变动值 //var stockValue int64 //库存变动值
@ -188,7 +191,7 @@ func (p *Player) saveGameRecord(betWin, betTotal, win, rate, returnBet int64, t
stockRecord.RoomNormalWin = total stockRecord.RoomNormalWin = total
} }
stockValue := -(win + betWin - betTotal) - darkValue stockValue := (win + betWin - betTotal) + darkValue
CheatValueChange := stockValue //点控值 CheatValueChange := stockValue //点控值
stockRecord.LightWater = rate stockRecord.LightWater = rate
@ -257,7 +260,8 @@ func (p *Player) saveGameRecord(betWin, betTotal, win, rate, returnBet int64, t
} else { } else {
CheatValue = 0 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.StockConfig = t.StockConf
stockRecord.StockId = t.StockId stockRecord.StockId = t.StockId
stockRecord.Stock = t.Stock stockRecord.Stock = t.Stock
//log.Infof("更新血池库存记录前,Stock:%v", t.Stock)
stockRecord.CurrentRoomNum = int32(t.PlayerCount) 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), //场次 Field: strconv.FormatInt(t.Id, 10), //场次
TaxRate: float32(t.Conf.RoomRate), //税率 TaxRate: float32(t.Conf.RoomRate), //税率
BetAmount: betTotal, //下注总额 BetAmount: betTotal, //下注总额
WinAmount: total, //盈利 WinAmount: userWin, //盈利
TaxAmount: rate, //税收 输了没有税收 TaxAmount: rate, //税收 输了没有税收
PlayerBetTotal: betTotal, //玩家总下注额 PlayerBetTotal: betTotal, //玩家总下注额
BeforeBalance: p.BeforeBalance, BeforeBalance: p.BeforeBalance,

12
game-server/game/service/rpc_client/rpc_game.go

@ -160,6 +160,7 @@ func InertGameControlRecord(ctx *node.Proxy, UserId, CheatType, CheatValue int64
GameId: GameId, GameId: GameId,
RoomId: RoomId, RoomId: RoomId,
AgentId: AgentId, AgentId: AgentId,
//BetAmount:
}) })
if err != nil { if err != nil {
return err return err
@ -185,11 +186,12 @@ func UpdateGameControlCheatValue(ctx *node.Proxy, UserId, CheatValue int64) erro
// 添加血池库存变动记录 // 添加血池库存变动记录
func GameRecordBloodStock(param *dao.GameResultCalculate, stockValue int64) error { func GameRecordBloodStock(param *dao.GameResultCalculate, stockValue int64) error {
log.Infof("添加血池库存变动记录,Stock:%v,stockValue:%v", param.Stock, stockValue)
stockAfter := int64(0) stockAfter := int64(0)
if param.IsPoint == true { if param.IsPoint == true {
stockAfter = param.Stock stockAfter = param.Stock
} else { } else {
stockAfter = param.Stock + stockValue stockAfter = param.Stock - stockValue
} }
res := &dao.GameRecordBloodStock{ res := &dao.GameRecordBloodStock{
UserId: param.UID, UserId: param.UID,
@ -270,7 +272,7 @@ func PushGameResultCalculate(param *dao.GameResultCalculate) (*constant.GameReco
// 明水 // 明水
var brightValue int64 = int64(float64(param.BetTotal) * float64(param.BrightRate)) var brightValue int64 = int64(float64(param.BetTotal) * float64(param.BrightRate))
total := int64(0) total := int64(0)
userWin := int64(0) //玩家输赢不扣明水
// 点控值 // 点控值
CheatValueChange := int64(0) CheatValueChange := int64(0)
@ -281,13 +283,14 @@ func PushGameResultCalculate(param *dao.GameResultCalculate) (*constant.GameReco
darkValue = int64(float64(param.BetTotal) * float64(param.DarkRate)) darkValue = int64(float64(param.BetTotal) * float64(param.DarkRate))
// 玩家赢了的获取值 // 玩家赢了的获取值
total = param.BetTotal - brightValue - param.BetAmount //赢的数字 total = param.BetTotal - brightValue - param.BetAmount //赢的数字
userWin = param.BetTotal - param.BetAmount
param.LightWater = brightValue param.LightWater = brightValue
param.DarkWater = darkValue param.DarkWater = darkValue
//血池白名单,输赢不影响血池(库存,暗水) //血池白名单,输赢不影响血池(库存,暗水)
CheatValueChange = param.BetTotal - param.BetAmount CheatValueChange = param.BetTotal - param.BetAmount
// 库存变动值 --- 赢了 // 库存变动值 --- 赢了
stockValue = param.BetTotal + darkValue - param.BetAmount stockValue = param.BetTotal - param.BetAmount + darkValue
if isInWhiteList { if isInWhiteList {
CheatValueChange = 0 CheatValueChange = 0
@ -312,6 +315,7 @@ func PushGameResultCalculate(param *dao.GameResultCalculate) (*constant.GameReco
darkValue = int64(float64(param.BetAmount) * float64(param.DarkRate)) darkValue = int64(float64(param.BetAmount) * float64(param.DarkRate))
// 玩家输了的获取值 // 玩家输了的获取值
total = -param.BetAmount //输的数字 total = -param.BetAmount //输的数字
userWin = -param.BetAmount
param.LightWater = 0 param.LightWater = 0
param.DarkWater = darkValue param.DarkWater = darkValue
// 明水暗水 // 明水暗水
@ -391,7 +395,7 @@ func PushGameResultCalculate(param *dao.GameResultCalculate) (*constant.GameReco
Field: param.RoomName, //场次 Field: param.RoomName, //场次
TaxRate: float32(param.BrightRate), //税率 TaxRate: float32(param.BrightRate), //税率
BetAmount: param.BetTotal, //下注总额 BetAmount: param.BetTotal, //下注总额
WinAmount: total, //盈利 WinAmount: userWin, //盈利
TaxAmount: param.LightWater, //税收 输了没有税收 TaxAmount: param.LightWater, //税收 输了没有税收
PlayerBetTotal: param.PlayerBetTotal, //玩家总下注额 PlayerBetTotal: param.PlayerBetTotal, //玩家总下注额
BeforeBalance: param.BeforeBalance, BeforeBalance: param.BeforeBalance,

8
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)) time.Sleep(time.Millisecond * time.Duration(intervalTime))
} }
isAgree := other.AIIsAgreeCompareCard() isAgree := other.AIIsAgreeCompareCard()
isAgree = false
if isAgree { if isAgree {
//同意比牌 //同意比牌
AgreeTime := tools.GetRandomRange(2, int32(tools.StrToInt64(b.room.Global.RoundTime)/2)) 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 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() { 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: "最大下注限制"})
} }
} }

Loading…
Cancel
Save