add suarrush test02
This commit is contained in:
parent
2035a5138d
commit
4adf1f90b1
|
@ -8,41 +8,21 @@ const (
|
||||||
FortuneMouse = "FortuneMouse"
|
FortuneMouse = "FortuneMouse"
|
||||||
CashMania = "CashMania"
|
CashMania = "CashMania"
|
||||||
GatesOfOlympus = "GatesOfOlympus"
|
GatesOfOlympus = "GatesOfOlympus"
|
||||||
|
FortuneSnake = "FortuneSnake"
|
||||||
|
GaneshaGold = "GaneshaGold"
|
||||||
SugarRush = "SugarRush"
|
SugarRush = "SugarRush"
|
||||||
Test = "Test"
|
Test = "Test"
|
||||||
)
|
)
|
||||||
const (
|
|
||||||
GameId_Min uint = iota
|
|
||||||
GameId_Tiger
|
|
||||||
GameId_Dragon
|
|
||||||
GameId_Rabbit
|
|
||||||
GameId_OX
|
|
||||||
GameId_Mouse
|
|
||||||
GameId_Cash_Mania
|
|
||||||
GameId_GatesOfOlympus
|
|
||||||
|
|
||||||
GameId_Max
|
var GameKeyMap = map[int64]string{
|
||||||
GameId_Test = 999
|
308: FortuneTiger,
|
||||||
)
|
309: FortuneDragon,
|
||||||
|
310: FortuneRabbit,
|
||||||
var GameMap = map[uint]string{
|
311: FortuneOx,
|
||||||
GameId_Tiger: FortuneTiger,
|
312: FortuneMouse,
|
||||||
GameId_Dragon: FortuneDragon,
|
313: CashMania,
|
||||||
GameId_Rabbit: FortuneRabbit,
|
314: GatesOfOlympus,
|
||||||
GameId_OX: FortuneOx,
|
315: FortuneSnake,
|
||||||
GameId_Mouse: FortuneMouse,
|
316: GaneshaGold,
|
||||||
GameId_Cash_Mania: CashMania,
|
317: SugarRush,
|
||||||
GameId_GatesOfOlympus: GatesOfOlympus,
|
|
||||||
GameId_Test: Test,
|
|
||||||
}
|
|
||||||
var GameKeyMap = map[int64]uint{
|
|
||||||
0: GameId_Min,
|
|
||||||
308: GameId_Tiger,
|
|
||||||
309: GameId_Dragon,
|
|
||||||
310: GameId_Rabbit,
|
|
||||||
311: GameId_OX,
|
|
||||||
312: GameId_Mouse,
|
|
||||||
313: GameId_Cash_Mania,
|
|
||||||
314: GameId_GatesOfOlympus,
|
|
||||||
999: GameId_Max,
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (sm *SlotsMgr) Enter(s *base.SlotsSession, gameId int64) (*cli.SlotsEnterResponse, error) {
|
func (sm *SlotsMgr) Enter(s *base.SlotsSession, gameId int64) (*cli.SlotsEnterResponse, error) {
|
||||||
if gid, ok := key.GameKeyMap[gameId]; ok {
|
var theme string
|
||||||
gameId = int64(gid)
|
if tm, ok := key.GameKeyMap[gameId]; ok {
|
||||||
|
theme = tm
|
||||||
} else {
|
} else {
|
||||||
logger.Logger.Error("[slotsMgr.Enter] gameId not exist")
|
logger.Logger.Error("[slotsMgr.Enter] gameId not exist")
|
||||||
return nil, errors.New("gameId not exist")
|
return nil, errors.New("gameId not exist")
|
||||||
|
@ -24,8 +25,6 @@ func (sm *SlotsMgr) Enter(s *base.SlotsSession, gameId int64) (*cli.SlotsEnterRe
|
||||||
|
|
||||||
player.Init(s)
|
player.Init(s)
|
||||||
|
|
||||||
theme := key.GameMap[uint(gameId)]
|
|
||||||
|
|
||||||
m := machine.NewMachine(s, theme, DataSet(s).Shell, false)
|
m := machine.NewMachine(s, theme, DataSet(s).Shell, false)
|
||||||
if m == nil {
|
if m == nil {
|
||||||
logger.Logger.Error("[slotsMgr.enter] module is nil")
|
logger.Logger.Error("[slotsMgr.enter] module is nil")
|
||||||
|
@ -56,8 +55,9 @@ func (sm *SlotsMgr) Enter(s *base.SlotsSession, gameId int64) (*cli.SlotsEnterRe
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sm *SlotsMgr) Play(s *base.SlotsSession, req *base.SpinReq) (*cli.SlotsPlayResponse, error) {
|
func (sm *SlotsMgr) Play(s *base.SlotsSession, req *base.SpinReq) (*cli.SlotsPlayResponse, error) {
|
||||||
if gameId, ok := key.GameKeyMap[req.GameId]; ok {
|
var theme string
|
||||||
req.GameId = int64(gameId)
|
if tm, ok := key.GameKeyMap[req.GameId]; ok {
|
||||||
|
theme = tm
|
||||||
} else {
|
} else {
|
||||||
logger.Logger.Error("[slotsMgr.play] gameId not exist")
|
logger.Logger.Error("[slotsMgr.play] gameId not exist")
|
||||||
return nil, errors.New("gameId not exist")
|
return nil, errors.New("gameId not exist")
|
||||||
|
@ -80,7 +80,6 @@ func (sm *SlotsMgr) Play(s *base.SlotsSession, req *base.SpinReq) (*cli.SlotsPla
|
||||||
|
|
||||||
player.Get(s).Book.Coin.Set(s.Coin())
|
player.Get(s).Book.Coin.Set(s.Coin())
|
||||||
|
|
||||||
theme := key.GameMap[uint(req.GameId)]
|
|
||||||
m := machine.NewMachine(s, theme, DataSet(s).Shell, false)
|
m := machine.NewMachine(s, theme, DataSet(s).Shell, false)
|
||||||
if m == nil {
|
if m == nil {
|
||||||
logger.Logger.Error("[slotsMgr.play] module is nil")
|
logger.Logger.Error("[slotsMgr.play] module is nil")
|
||||||
|
@ -162,3 +161,9 @@ func (*SlotsMgr) Leave(s *base.SlotsSession) (*cli.SlotsLeaveResponse, error) {
|
||||||
}
|
}
|
||||||
return Response, nil
|
return Response, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pp
|
||||||
|
func (sm *SlotsMgr) PPGetBetIndex(s *base.SlotsSession, theme string, val float64) []int64 {
|
||||||
|
m := machine.NewMachine(s, theme, DataSet(s).Shell, false)
|
||||||
|
return m.GetBetIndexByVal(val)
|
||||||
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ func (m *Machine) SyncLiteClose() *shared.LiteNodeTree {
|
||||||
// PlayLiteClose serialize the machine and transform into lite node tree for play
|
// PlayLiteClose serialize the machine and transform into lite node tree for play
|
||||||
func (m *Machine) PlayLiteClose() *shared.LiteNodeTree {
|
func (m *Machine) PlayLiteClose() *shared.LiteNodeTree {
|
||||||
m.Serialize()
|
m.Serialize()
|
||||||
m.Session.Remove(key.SessionMachine)
|
//m.Session.Remove(key.SessionMachine)
|
||||||
|
|
||||||
liteNodeTree := &shared.LiteNodeTree{
|
liteNodeTree := &shared.LiteNodeTree{
|
||||||
Step: m.NodeTree.Step,
|
Step: m.NodeTree.Step,
|
||||||
|
|
|
@ -12,10 +12,10 @@ type SugarRushPlayerData struct {
|
||||||
leaveTime int32 //离开时间
|
leaveTime int32 //离开时间
|
||||||
SlotsSession *base.SlotsSession
|
SlotsSession *base.SlotsSession
|
||||||
|
|
||||||
BetSizeIndex int64 `json:"bsi"` //选中的单注下标
|
//BetSizeIndex int64 `json:"bsi"` //选中的单注下标
|
||||||
BetLevelIndex int64 `json:"bli"` //选中的等级下标
|
//BetLevelIndex int64 `json:"bli"` //选中的等级下标
|
||||||
BetLineIndex int64 `json:"bii"` //选中的线数下标
|
//BetLineIndex int64 `json:"bii"` //选中的线数下标
|
||||||
BetMode int64 `json:"bm,optional"` //0.常规 1.%125 2.购买
|
BetMode int64 `json:"bm,optional"` //0.常规 1.%125 2.购买
|
||||||
|
|
||||||
taxCoin int64
|
taxCoin int64
|
||||||
winCoin int64
|
winCoin int64
|
||||||
|
|
|
@ -2,13 +2,11 @@ package sugarrush
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"mongo.games.com/game/gamesrv/base"
|
"mongo.games.com/game/gamesrv/base"
|
||||||
"mongo.games.com/game/gamesrv/slotspkg/assemble"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type SugarRushSceneData struct {
|
type SugarRushSceneData struct {
|
||||||
*base.Scene //场景
|
*base.Scene //场景
|
||||||
players map[int32]*SugarRushPlayerData //玩家信息
|
players map[int32]*SugarRushPlayerData //玩家信息
|
||||||
BetConfig *assemble.BetConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSugarRushSceneData(s *base.Scene) *SugarRushSceneData {
|
func NewSugarRushSceneData(s *base.Scene) *SugarRushSceneData {
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"mongo.games.com/game/common"
|
"mongo.games.com/game/common"
|
||||||
"mongo.games.com/game/gamerule/sugarrush"
|
"mongo.games.com/game/gamerule/sugarrush"
|
||||||
"mongo.games.com/game/gamesrv/base"
|
"mongo.games.com/game/gamesrv/base"
|
||||||
"mongo.games.com/game/gamesrv/slotspkg/assemble"
|
|
||||||
"mongo.games.com/game/gamesrv/slotspkg/slots"
|
"mongo.games.com/game/gamesrv/slotspkg/slots"
|
||||||
|
"mongo.games.com/game/gamesrv/slotspkg/slots/types/cli"
|
||||||
"mongo.games.com/game/model"
|
"mongo.games.com/game/model"
|
||||||
"mongo.games.com/game/proto"
|
"mongo.games.com/game/proto"
|
||||||
"mongo.games.com/game/protocol/server"
|
"mongo.games.com/game/protocol/server"
|
||||||
|
@ -214,12 +214,8 @@ func SugarRushCreateRoomInfoPacket(s *base.Scene, sceneEx *SugarRushSceneData, p
|
||||||
//get data
|
//get data
|
||||||
Response, err := slots.SlotsMgrSington.Enter(playerEx.SlotsSession, int64(s.GameId))
|
Response, err := slots.SlotsMgrSington.Enter(playerEx.SlotsSession, int64(s.GameId))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
data := assemble.DataToCli(Response).(assemble.TableInfo)
|
pi, _ := json.Marshal(Response)
|
||||||
pi, _ := json.Marshal(data)
|
|
||||||
pack.PlayerInfo = string(pi)
|
pack.PlayerInfo = string(pi)
|
||||||
if sceneEx.BetConfig == nil {
|
|
||||||
sceneEx.BetConfig = &data.BetConfig
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
logger.Logger.Error("slots enter err:", err)
|
logger.Logger.Error("slots enter err:", err)
|
||||||
}
|
}
|
||||||
|
@ -375,13 +371,10 @@ func (this *SceneStateStartSugarRush) OnPlayerOp(s *base.Scene, p *base.Player,
|
||||||
playerEx.SendToClient(int(protocol.SugarRushPID_PACKET_SUGARRUSH_SCSUGARRUSHBILLED), pack)
|
playerEx.SendToClient(int(protocol.SugarRushPID_PACKET_SUGARRUSH_SCSUGARRUSHBILLED), pack)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
playerEx.BetSizeIndex = params[0]
|
cval := params[0]
|
||||||
playerEx.BetLevelIndex = params[1]
|
playerEx.BetMode = params[1]
|
||||||
playerEx.BetLineIndex = params[2]
|
needCoin := cval * 20
|
||||||
playerEx.BetMode = params[3]
|
if needCoin > playerEx.Coin && !playerEx.isFree {
|
||||||
needCoin := sceneEx.BetConfig.BetSize[params[0]] * float64(sceneEx.BetConfig.BetLevel[params[1]]) *
|
|
||||||
float64(sceneEx.BetConfig.BetLines[params[2]]) * float64(sceneEx.BetConfig.BaseBet[params[2]])
|
|
||||||
if needCoin > float64(playerEx.Coin) && !playerEx.isFree {
|
|
||||||
pack := &protocol.SCSugarRushBilled{
|
pack := &protocol.SCSugarRushBilled{
|
||||||
OpRetCode: proto.Int32(1),
|
OpRetCode: proto.Int32(1),
|
||||||
}
|
}
|
||||||
|
@ -394,73 +387,94 @@ func (this *SceneStateStartSugarRush) OnPlayerOp(s *base.Scene, p *base.Player,
|
||||||
//playerEx.SlotsSession.SetCoin(playerEx.Coin * sugarrush.NowByte)
|
//playerEx.SlotsSession.SetCoin(playerEx.Coin * sugarrush.NowByte)
|
||||||
//logger.Logger.Trace("=============init dif coin", playerEx.Coin-playerEx.SlotsSession.Coin()/sugarrush.NowByte)
|
//logger.Logger.Trace("=============init dif coin", playerEx.Coin-playerEx.SlotsSession.Coin()/sugarrush.NowByte)
|
||||||
|
|
||||||
|
index := slots.SlotsMgrSington.PPGetBetIndex(playerEx.SlotsSession, "SugarRush", float64(cval*20))
|
||||||
|
if index == nil {
|
||||||
|
pack := &protocol.SCSugarRushBilled{
|
||||||
|
OpRetCode: proto.Int32(2),
|
||||||
|
}
|
||||||
|
proto.SetDefaults(pack)
|
||||||
|
logger.Logger.Trace("SCSugarRushBilled:", pack.String())
|
||||||
|
playerEx.SendToClient(int(protocol.SugarRushPID_PACKET_SUGARRUSH_SCSUGARRUSHBILLED), pack)
|
||||||
|
return true
|
||||||
|
}
|
||||||
//get data
|
//get data
|
||||||
Response, err := slots.SlotsMgrSington.Play(playerEx.SlotsSession, &base.SpinReq{
|
Response, err := slots.SlotsMgrSington.Play(playerEx.SlotsSession, &base.SpinReq{
|
||||||
GameId: int64(sceneEx.GameId),
|
GameId: int64(sceneEx.GameId),
|
||||||
BetSizeIndex: playerEx.BetSizeIndex,
|
BetSizeIndex: index[0],
|
||||||
BetLevelIndex: playerEx.BetLevelIndex,
|
BetLevelIndex: index[1],
|
||||||
BetLineIndex: playerEx.BetLineIndex,
|
BetLineIndex: 0,
|
||||||
BetMode: playerEx.BetMode,
|
BetMode: playerEx.BetMode,
|
||||||
Ts: time.Now().Unix(),
|
Ts: time.Now().Unix(),
|
||||||
})
|
})
|
||||||
var gameEndStr string
|
if err != nil {
|
||||||
var data assemble.GameEnd
|
logger.Logger.Error("slots Play err:", err)
|
||||||
if err == nil {
|
pack := &protocol.SCSugarRushBilled{
|
||||||
s.SetGameNowTime(time.Now())
|
OpRetCode: proto.Int32(3),
|
||||||
data = assemble.DataToCli(Response).(assemble.GameEnd)
|
|
||||||
|
|
||||||
data.BetSizeIndex = playerEx.BetSizeIndex
|
|
||||||
data.BetLevelIndex = playerEx.BetLevelIndex
|
|
||||||
data.LinesIndex = playerEx.BetLineIndex
|
|
||||||
//data.BaseBetIndex = 1
|
|
||||||
|
|
||||||
data.Results[0].BetMode = playerEx.BetMode
|
|
||||||
if data.Results[0].FreeStatus == 1 || data.Results[0].FreeNumMax == 0 {
|
|
||||||
//logger.Logger.Trace("=====================AddCoin=====TotalBet===", -data.TotalBet)
|
|
||||||
//第一次触发或者正常模式
|
|
||||||
playerEx.AddCoin(int64(-data.TotalBet), common.GainWay_HundredSceneLost, base.SyncFlag_ToClient, "system", s.GetSceneName())
|
|
||||||
playerEx.totalBet = int64(data.TotalBet)
|
|
||||||
}
|
}
|
||||||
var taxCoin float64
|
proto.SetDefaults(pack)
|
||||||
if data.RoundReward > 0 {
|
logger.Logger.Trace("SCSugarRushBilled:", pack.String())
|
||||||
|
playerEx.SendToClient(int(protocol.SugarRushPID_PACKET_SUGARRUSH_SCSUGARRUSHBILLED), pack)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
var ActualWin = Response.ActualWin / sugarrush.NowByte
|
||||||
|
s.SetGameNowTime(time.Now())
|
||||||
|
midNodes := Response.NodeTree.Nodes[1]
|
||||||
|
lastNodes := Response.NodeTree.Nodes[2]
|
||||||
|
playerEx.isFree = false
|
||||||
|
var needWinBilled = true
|
||||||
|
|
||||||
|
var totalIn, totalOut int64
|
||||||
|
//下注
|
||||||
|
if midNodes.Type == "BaseSpin" && lastNodes.Type == "FreeSpin" {
|
||||||
|
playerEx.isFree = true
|
||||||
|
needWinBilled = false
|
||||||
|
if lastNodes.ProgressValue == 0 {
|
||||||
|
//第一次触发
|
||||||
|
playerEx.totalBet = Response.ActualBet / sugarrush.NowByte
|
||||||
|
playerEx.AddCoin(-playerEx.totalBet, common.GainWay_HundredSceneLost, base.SyncFlag_ToClient, "system", s.GetSceneName())
|
||||||
|
totalIn = playerEx.totalBet
|
||||||
|
}
|
||||||
|
if lastNodes.ProgressValue == lastNodes.ProgressMax {
|
||||||
|
needWinBilled = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//正常模式
|
||||||
|
playerEx.totalBet = Response.ActualBet / sugarrush.NowByte
|
||||||
|
totalIn = playerEx.totalBet
|
||||||
|
playerEx.AddCoin(-playerEx.totalBet, common.GainWay_HundredSceneLost, base.SyncFlag_ToClient, "system", s.GetSceneName())
|
||||||
|
}
|
||||||
|
|
||||||
|
if needWinBilled {
|
||||||
|
var taxCoin int64
|
||||||
|
if ActualWin > 0 {
|
||||||
//税收比例
|
//税收比例
|
||||||
taxRate := sceneEx.GetDBGameFree().GetTaxRate()
|
taxRate := sceneEx.GetDBGameFree().GetTaxRate()
|
||||||
if taxRate < 0 || taxRate > 10000 {
|
if taxRate < 0 || taxRate > 10000 {
|
||||||
taxRate = 500
|
taxRate = 500
|
||||||
}
|
}
|
||||||
taxCoin = data.RoundReward * float64(taxRate) / 10000
|
taxCoin = ActualWin * int64(taxRate) / 10000
|
||||||
data.RoundReward = data.RoundReward - taxCoin
|
playerEx.AddServiceFee(taxCoin)
|
||||||
playerEx.AddServiceFee(int64(taxCoin))
|
playerEx.taxCoin = taxCoin
|
||||||
playerEx.taxCoin = int64(taxCoin)
|
playerEx.winCoin = ActualWin - taxCoin
|
||||||
playerEx.winCoin = int64(data.RoundReward)
|
ActualWin = playerEx.winCoin
|
||||||
}
|
}
|
||||||
pi, _ := json.Marshal(data)
|
|
||||||
gameEndStr = string(pi)
|
|
||||||
|
|
||||||
if data.Results[0].FreeStatus == 3 || data.Results[0].FreeNumMax == 0 {
|
totalOut = ActualWin
|
||||||
//logger.Logger.Trace("=====================AddCoin=====RoundReward===", data.RoundReward)
|
|
||||||
playerEx.AddCoin(int64(data.RoundReward), common.GainWay_HundredSceneWin, 0, "system", s.GetSceneName())
|
playerEx.AddCoin(ActualWin, common.GainWay_HundredSceneWin, 0, "system", s.GetSceneName())
|
||||||
//免费游戏结束或者正常模式
|
//免费游戏结束或者正常模式
|
||||||
sceneEx.StaticsLaba(&base.StaticLabaParam{
|
sceneEx.StaticsLaba(&base.StaticLabaParam{
|
||||||
SnId: playerEx.SnId,
|
SnId: playerEx.SnId,
|
||||||
Gain: int64(data.RoundReward - data.TotalBet),
|
Gain: ActualWin - playerEx.totalBet,
|
||||||
GainTax: int64(taxCoin),
|
GainTax: playerEx.taxCoin,
|
||||||
IsAddTimes: true,
|
IsAddTimes: true,
|
||||||
})
|
})
|
||||||
}
|
|
||||||
if data.Results[0].FreeNum > 0 {
|
|
||||||
playerEx.isFree = true
|
|
||||||
} else {
|
|
||||||
playerEx.isFree = false
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
logger.Logger.Error("slots Play err:", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
playerEx.SlotsSession.SetCoin(int64(data.FinalCoin) * sugarrush.NowByte)
|
playerEx.SlotsSession.SetCoin(Response.Coin)
|
||||||
//logger.Logger.Trace("=====================end===== playerEx.Coin===", playerEx.Coin)
|
|
||||||
//logger.Logger.Trace("=====================end===== data.FinalCoin===", data.FinalCoin)
|
|
||||||
|
|
||||||
|
pi, _ := json.Marshal(Response)
|
||||||
|
gameEndStr := string(pi)
|
||||||
pack := &protocol.SCSugarRushBilled{
|
pack := &protocol.SCSugarRushBilled{
|
||||||
OpRetCode: proto.Int32(0),
|
OpRetCode: proto.Int32(0),
|
||||||
GameEndStr: proto.String(gameEndStr),
|
GameEndStr: proto.String(gameEndStr),
|
||||||
|
@ -469,12 +483,12 @@ func (this *SceneStateStartSugarRush) OnPlayerOp(s *base.Scene, p *base.Player,
|
||||||
logger.Logger.Trace("SCSugarRushBilled", pack.String())
|
logger.Logger.Trace("SCSugarRushBilled", pack.String())
|
||||||
playerEx.SendToClient(int(protocol.SugarRushPID_PACKET_SUGARRUSH_SCSUGARRUSHBILLED), pack)
|
playerEx.SendToClient(int(protocol.SugarRushPID_PACKET_SUGARRUSH_SCSUGARRUSHBILLED), pack)
|
||||||
|
|
||||||
if playerEx.Coin != int64(data.FinalCoin) {
|
if playerEx.Coin != ActualWin {
|
||||||
logger.Logger.Error("==========playerEx.Coin != Response.Coin==============", playerEx.Coin, data.FinalCoin)
|
logger.Logger.Error("==========playerEx.Coin != Response.Coin==============", playerEx.Coin, ActualWin)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 记录本次操作
|
// 记录本次操作
|
||||||
SugarRushAndSaveLog(sceneEx, playerEx, data)
|
SugarRushAndSaveLog(sceneEx, playerEx, Response, totalIn, totalOut)
|
||||||
case 1000:
|
case 1000:
|
||||||
playerEx.Save(0)
|
playerEx.Save(0)
|
||||||
}
|
}
|
||||||
|
@ -511,23 +525,13 @@ func (this *ScenePolicySugarRush) GetSceneState(s *base.Scene, stateid int) base
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func SugarRushAndSaveLog(sceneEx *SugarRushSceneData, playerEx *SugarRushPlayerData, data assemble.GameEnd) {
|
func SugarRushAndSaveLog(sceneEx *SugarRushSceneData, playerEx *SugarRushPlayerData, Response *cli.SlotsPlayResponse,
|
||||||
|
totalIn, totalOut int64) {
|
||||||
if !playerEx.IsRob {
|
if !playerEx.IsRob {
|
||||||
data.SnId = playerEx.SnId
|
info, err := model.MarshalGameNoteByROLL(Response)
|
||||||
if data.Results[0].FreeStatus != 1 && data.Results[0].FreeNumMax != 0 {
|
|
||||||
data.TotalBet = 0
|
|
||||||
}
|
|
||||||
info, err := model.MarshalGameNoteByROLL(data)
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
logid, _ := model.AutoIncGameLogId()
|
logid, _ := model.AutoIncGameLogId()
|
||||||
playerEx.currentLogId = logid
|
playerEx.currentLogId = logid
|
||||||
var totalin, totalout int64
|
|
||||||
if data.Results[0].FreeStatus == 1 || data.Results[0].FreeNumMax == 0 {
|
|
||||||
totalin = playerEx.totalBet
|
|
||||||
}
|
|
||||||
if data.Results[0].FreeStatus == 3 || data.Results[0].FreeNumMax == 0 {
|
|
||||||
totalout = int64(data.RoundReward) + playerEx.taxCoin
|
|
||||||
}
|
|
||||||
playerEx.Cache(sceneEx.Scene, &base.SaveGameDetailedParam{
|
playerEx.Cache(sceneEx.Scene, &base.SaveGameDetailedParam{
|
||||||
LogId: logid,
|
LogId: logid,
|
||||||
Detail: info,
|
Detail: info,
|
||||||
|
@ -536,11 +540,11 @@ func SugarRushAndSaveLog(sceneEx *SugarRushSceneData, playerEx *SugarRushPlayerD
|
||||||
Platform: playerEx.Platform,
|
Platform: playerEx.Platform,
|
||||||
Snid: playerEx.SnId,
|
Snid: playerEx.SnId,
|
||||||
PlayerName: playerEx.Name,
|
PlayerName: playerEx.Name,
|
||||||
TotalIn: totalin,
|
TotalIn: totalIn,
|
||||||
TotalOut: totalout,
|
TotalOut: totalOut,
|
||||||
TaxCoin: playerEx.taxCoin,
|
TaxCoin: playerEx.taxCoin,
|
||||||
BetAmount: totalin,
|
BetAmount: totalIn,
|
||||||
WinAmountNoAnyTax: totalout - totalin - playerEx.taxCoin,
|
WinAmountNoAnyTax: totalOut - totalIn - playerEx.taxCoin,
|
||||||
IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player),
|
IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player),
|
||||||
IsFree: playerEx.isFree,
|
IsFree: playerEx.isFree,
|
||||||
})
|
})
|
||||||
|
@ -552,7 +556,7 @@ func SugarRushAndSaveLog(sceneEx *SugarRushSceneData, playerEx *SugarRushPlayerD
|
||||||
playerBet := &server.PlayerData{
|
playerBet := &server.PlayerData{
|
||||||
SnId: proto.Int32(playerEx.SnId),
|
SnId: proto.Int32(playerEx.SnId),
|
||||||
Bet: proto.Int64(playerEx.CurrentBet),
|
Bet: proto.Int64(playerEx.CurrentBet),
|
||||||
Gain: proto.Int64(int64(data.RoundReward) + playerEx.taxCoin),
|
Gain: proto.Int64(Response.ActualWin/sugarrush.NowByte + playerEx.taxCoin),
|
||||||
Tax: proto.Int64(playerEx.taxCoin),
|
Tax: proto.Int64(playerEx.taxCoin),
|
||||||
Coin: proto.Int64(playerEx.GetCoin()),
|
Coin: proto.Int64(playerEx.GetCoin()),
|
||||||
GameCoinTs: proto.Int64(playerEx.GameCoinTs),
|
GameCoinTs: proto.Int64(playerEx.GameCoinTs),
|
||||||
|
@ -571,7 +575,7 @@ func SugarRushAndSaveLog(sceneEx *SugarRushSceneData, playerEx *SugarRushPlayerD
|
||||||
playerEx.taxCoin = 0
|
playerEx.taxCoin = 0
|
||||||
playerEx.winCoin = 0
|
playerEx.winCoin = 0
|
||||||
|
|
||||||
if sceneEx.CheckNeedDestroy() && data.Results[0].FreeNum <= 0 {
|
if sceneEx.CheckNeedDestroy() && !playerEx.isFree {
|
||||||
sceneEx.SceneDestroy(true)
|
sceneEx.SceneDestroy(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ message SCSugarRushRoomInfo {
|
||||||
//PACKET_SUGARRUSH_CSSUGARRUSHOP
|
//PACKET_SUGARRUSH_CSSUGARRUSHOP
|
||||||
message CSSugarRushOp {
|
message CSSugarRushOp {
|
||||||
int32 OpCode = 1; //操作码 0.spin
|
int32 OpCode = 1; //操作码 0.spin
|
||||||
repeated int64 Params = 2; //操作参数 下注索引编号
|
repeated int64 Params = 2; //操作参数 cval
|
||||||
}
|
}
|
||||||
//玩家操作返回
|
//玩家操作返回
|
||||||
//PACKET_SUGARRUSH_SCSUGARRUSHOP
|
//PACKET_SUGARRUSH_SCSUGARRUSHOP
|
||||||
|
|
Loading…
Reference in New Issue