|
|
@ -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, |
|
|
|