创建房间参数优化

This commit is contained in:
sk 2024-08-28 16:08:55 +08:00
parent cae5536ed3
commit bfdf500eec
43 changed files with 2702 additions and 2637 deletions

View File

@ -83,7 +83,7 @@ func (this *CSLeaveRoomHandler) Process(s *netlib.Session, packetid int, data in
logger.Logger.Warnf("CSLeaveRoomHandler[%v][%v] scene.gaming==true", scene.SceneId, p.SnId) logger.Logger.Warnf("CSLeaveRoomHandler[%v][%v] scene.gaming==true", scene.SceneId, p.SnId)
pack := &gamehall.SCLeaveRoom{ pack := &gamehall.SCLeaveRoom{
OpRetCode: gamehall.OpResultCode_Game_OPRC_YourAreGamingCannotLeave_Game, OpRetCode: gamehall.OpResultCode_Game_OPRC_YourAreGamingCannotLeave_Game,
RoomId: proto.Int(scene.SceneId), RoomId: scene.SceneId,
} }
proto.SetDefaults(pack) proto.SetDefaults(pack)
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_LEAVEROOM), pack) p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_LEAVEROOM), pack)
@ -100,7 +100,7 @@ func (this *CSLeaveRoomHandler) Process(s *netlib.Session, packetid int, data in
Reason: proto.Int(0), Reason: proto.Int(0),
OpRetCode: gamehall.OpResultCode_Game_OPRC_Sucess_Game, OpRetCode: gamehall.OpResultCode_Game_OPRC_Sucess_Game,
Mode: msg.Mode, Mode: msg.Mode,
RoomId: proto.Int(scene.SceneId), RoomId: scene.SceneId,
} }
proto.SetDefaults(pack) proto.SetDefaults(pack)
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_LEAVEROOM), pack) p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_LEAVEROOM), pack)

View File

@ -73,64 +73,22 @@ func HandleWGPlayerLeave(session *netlib.Session, packetId int, data interface{}
// return nil // return nil
//} //}
func init() { func CreateSceneHandler(session *netlib.Session, packetId int, data interface{}) error {
//创建场景 logger.Logger.Tracef("receive CreateScene %v", data)
netlib.RegisterFactory(int(server.SSPacketID_PACKET_WG_CREATESCENE), netlib.PacketFactoryWrapper(func() interface{} { msg, ok := data.(*server.WGCreateScene)
return &server.WGCreateScene{} if !ok {
}))
netlib.RegisterHandler(int(server.SSPacketID_PACKET_WG_CREATESCENE), netlib.HandlerWrapper(func(s *netlib.Session, packetid int, pack interface{}) error {
logger.Logger.Trace("receive WGCreateScene:", pack)
if msg, ok := pack.(*server.WGCreateScene); ok {
sceneId := int(msg.GetSceneId())
gameMode := int(msg.GetGameMode())
sceneMode := int(msg.GetSceneMode())
gameId := int(msg.GetGameId())
hallId := msg.GetHallId()
groupId := msg.GetGroupId()
dbGameFree := msg.GetDBGameFree()
bEnterAfterStart := msg.GetEnterAfterStart()
totalOfGames := msg.GetTotalOfGames()
baseScore := msg.GetBaseScore()
playerNum := int(msg.GetPlayerNum())
scene := base.SceneMgrSington.CreateScene(s, sceneId, gameMode, sceneMode, gameId, msg.GetPlatform(), msg.GetParams(),
msg.GetAgentor(), msg.GetCreator(), msg.GetReplayCode(), hallId, groupId, totalOfGames, dbGameFree,
bEnterAfterStart, baseScore, playerNum, msg.GetChessRank())
if scene != nil {
if scene.IsMatchScene() {
if len(scene.Params) > 0 {
scene.MatchId = scene.Params[0]
}
if len(scene.Params) > 1 {
scene.MatchFinals = scene.Params[1] == 1
}
if len(scene.Params) > 2 {
scene.MatchRound = scene.Params[2]
}
if len(scene.Params) > 3 {
scene.MatchCurPlayerNum = scene.Params[3]
}
if len(scene.Params) > 4 {
scene.MatchNextNeed = scene.Params[4]
}
if len(scene.Params) > 5 {
scene.MatchType = scene.Params[5]
}
}
for _, v := range msg.GetItems() {
scene.Items = append(scene.Items, &base.ItemInfo{
Id: v.GetId(),
Num: v.GetNum(),
})
}
scene.ClubId = msg.GetClub()
scene.RoomId = msg.GetClubRoomId()
scene.RoomPos = msg.GetClubRoomPos()
scene.PumpCoin = msg.GetClubRate()
scene.RealCtrl = msg.RealCtrl
}
}
return nil return nil
})) }
base.SceneMgrSington.CreateScene(&base.CreateSceneParam{
Session: session,
WGCreateScene: msg,
})
return nil
}
func init() {
// 创建房间
netlib.Register(int(server.SSPacketID_PACKET_WG_CREATESCENE), &server.WGCreateScene{}, CreateSceneHandler)
//删除场景 //删除场景
// 立刻删除,不管游戏是否结束 // 立刻删除,不管游戏是否结束
@ -280,7 +238,7 @@ func init() {
} }
if scene.Testing { if scene.Testing {
p.Coin = int64(scene.DbGameFree.GetTestTakeCoin()) p.Coin = int64(scene.GetDBGameFree().GetTestTakeCoin())
} }
base.PlayerMgrSington.ManagePlayer(p) base.PlayerMgrSington.ManagePlayer(p)
scene.PlayerEnter(p, isload) scene.PlayerEnter(p, isload)
@ -397,7 +355,7 @@ func init() {
//p.coin = msg.GetTakeCoin() //p.coin = msg.GetTakeCoin()
//p.takeCoin = msg.GetTakeCoin() //p.takeCoin = msg.GetTakeCoin()
if scene.Testing { if scene.Testing {
p.Coin = int64(scene.DbGameFree.GetTestTakeCoin()) p.Coin = int64(scene.GetDBGameFree().GetTestTakeCoin())
} }
p.LastSyncCoin = p.Coin p.LastSyncCoin = p.Coin
scene.AudienceSit(p) scene.AudienceSit(p)

View File

@ -57,14 +57,14 @@ func (this *AvengersSceneData) SceneDestroy(force bool) {
} }
func (this *AvengersSceneData) init() bool { func (this *AvengersSceneData) init() bool {
if this.DbGameFree == nil { if this.GetDBGameFree() == nil {
return false return false
} }
params := this.DbGameFree.GetJackpot() params := this.GetDBGameFree().GetJackpot()
this.jackpot = &base.SlotJackpotPool{} this.jackpot = &base.SlotJackpotPool{}
if this.jackpot.Small <= 0 { if this.jackpot.Small <= 0 {
this.jackpot.Small = 0 this.jackpot.Small = 0
this.jackpot.VirtualJK = int64(params[rule.AVENGERS_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) this.jackpot.VirtualJK = int64(params[rule.AVENGERS_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore())
} }
str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform) str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform)
if str != "" { if str != "" {
@ -100,7 +100,7 @@ type AvengersSpinResult struct {
} }
func (this *AvengersSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes AvengersSpinResult) { func (this *AvengersSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes AvengersSpinResult) {
taxRate := this.DbGameFree.GetTaxRate() taxRate := this.GetDBGameFree().GetTaxRate()
calcTaxScore := func(score int64, taxScore *int64) int64 { calcTaxScore := func(score int64, taxScore *int64) int64 {
newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0) newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0)
if taxScore != nil { if taxScore != nil {
@ -188,7 +188,7 @@ func (this *AvengersSceneData) BroadcastJackpot(sync bool) {
this.lastJackpotValue = this.jackpot.VirtualJK this.lastJackpotValue = this.jackpot.VirtualJK
pack := &gamehall.SCHundredSceneGetGameJackpot{} pack := &gamehall.SCHundredSceneGetGameJackpot{}
jpfi := &gamehall.GameJackpotFundInfo{ jpfi := &gamehall.GameJackpotFundInfo{
GameFreeId: proto.Int32(this.DbGameFree.Id), GameFreeId: proto.Int32(this.GetDBGameFree().Id),
JackPotFund: proto.Int64(this.jackpot.VirtualJK), JackPotFund: proto.Int64(this.jackpot.VirtualJK),
} }
pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi) pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi)
@ -215,7 +215,7 @@ func (this *AvengersSceneData) PopCoinPool(winCoin int64, IsNovice bool) {
} }
} }
func (this *AvengersSceneData) RecordBurstLog(name string, wincoin, totalbet int64) { func (this *AvengersSceneData) RecordBurstLog(name string, wincoin, totalbet int64) {
log := model.NewBurstJackpotLog(this.Platform, this.DbGameFree.GameId, this.GetGameFreeId(), name, wincoin, totalbet) log := model.NewBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId, this.GetGameFreeId(), name, wincoin, totalbet)
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.InsertBurstJackpotLogs(log) return model.InsertBurstJackpotLogs(log)
}), nil, "InsertBurstJackpotLogs").Start() }), nil, "InsertBurstJackpotLogs").Start()
@ -223,7 +223,7 @@ func (this *AvengersSceneData) RecordBurstLog(name string, wincoin, totalbet int
func (this *AvengersSceneData) BurstHistory(player *AvengersPlayerData) { func (this *AvengersSceneData) BurstHistory(player *AvengersPlayerData) {
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.GetBurstJackpotLog(this.Platform, this.DbGameFree.GameId) return model.GetBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId)
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
var logsp []*avengers.AvengersBurstHistoryInfo var logsp []*avengers.AvengersBurstHistoryInfo
if data != nil { if data != nil {
@ -251,7 +251,7 @@ func (this *AvengersSceneData) GetLastBurstJackPot() time.Time {
} }
func (this *AvengersSceneData) SetLastBurstJackPot() { func (this *AvengersSceneData) SetLastBurstJackPot() {
var randT = rand.Intn(25200-7200+1) + 7200 var randT = rand.Intn(25200-7200+1) + 7200
switch this.DbGameFree.SceneType { switch this.GetDBGameFree().SceneType {
case 1: case 1:
randT = rand.Intn(25200-7200+1) + 7200 randT = rand.Intn(25200-7200+1) + 7200
case 2: case 2:
@ -267,7 +267,7 @@ func (this *AvengersSceneData) SetLastBurstJackPot() {
func (this *AvengersSceneData) AIAddJackPot() { func (this *AvengersSceneData) AIAddJackPot() {
if time.Now().Sub(this.lastJackPot) > 0 { if time.Now().Sub(this.lastJackPot) > 0 {
var randT = rand.Intn(3) + 1 var randT = rand.Intn(3) + 1
switch this.DbGameFree.SceneType { switch this.GetDBGameFree().SceneType {
case 1: case 1:
randT = rand.Intn(3) + 1 randT = rand.Intn(3) + 1
case 2: case 2:
@ -280,20 +280,20 @@ func (this *AvengersSceneData) AIAddJackPot() {
randT = rand.Intn(3) + 1 randT = rand.Intn(3) + 1
} }
this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT)) this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT))
val := int64(math.Floor(float64(this.DbGameFree.GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000)) val := int64(math.Floor(float64(this.GetDBGameFree().GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
this.jackpot.VirtualJK += val this.jackpot.VirtualJK += val
} }
} }
func (this *AvengersSceneData) AIBurstJackPot() { func (this *AvengersSceneData) AIBurstJackPot() {
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 { if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
this.SetLastBurstJackPot() this.SetLastBurstJackPot()
jackpotParams := this.DbGameFree.GetJackpot() jackpotParams := this.GetDBGameFree().GetJackpot()
var jackpotInit = int64(jackpotParams[rule.AVENGERS_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) //奖池初始值 var jackpotInit = int64(jackpotParams[rule.AVENGERS_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) //奖池初始值
//AI机器人爆奖 //AI机器人爆奖
val := this.jackpot.VirtualJK val := this.jackpot.VirtualJK
this.jackpot.VirtualJK = jackpotInit this.jackpot.VirtualJK = jackpotInit
bet := int64(this.DbGameFree.GetBaseScore()) * int64(rule.LINENUM) bet := int64(this.GetDBGameFree().GetBaseScore()) * int64(rule.LINENUM)
this.RecordBurstLog(this.RandNickName(), val, bet) this.RecordBurstLog(this.RandNickName(), val, bet)
} }
} }
@ -314,11 +314,11 @@ func (this *AvengersSceneData) KickPlayerByTime() {
} }
//for _, p := range this.players { //for _, p := range this.players {
// //游戏次数达到目标值 // //游戏次数达到目标值
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId())) // todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.GetDBGameFree().GetId()))
// if !p.IsRob && // if !p.IsRob &&
// todayGamefreeIDSceneData != nil && // todayGamefreeIDSceneData != nil &&
// this.DbGameFree.GetPlayNumLimit() != 0 && // this.GetDBGameFree().GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) { // todayGamefreeIDSceneData.GameTimes >= int64(this.GetDBGameFree().GetPlayNumLimit()) {
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true) // this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
// } // }
//} //}

View File

@ -94,8 +94,8 @@ func (this *ScenePolicyAvengers) OnPlayerEnter(s *base.Scene, p *base.Player) {
logger.Logger.Trace("(this *ScenePolicyAvengers) OnPlayerEnter, SceneId=", s.SceneId, " player=", p.SnId) logger.Logger.Trace("(this *ScenePolicyAvengers) OnPlayerEnter, SceneId=", s.SceneId, " player=", p.SnId)
if sceneEx, ok := s.ExtraData.(*AvengersSceneData); ok { if sceneEx, ok := s.ExtraData.(*AvengersSceneData); ok {
playerEx := &AvengersPlayerData{Player: p} playerEx := &AvengersPlayerData{Player: p}
playerEx.init(s) // 玩家当前信息初始化 playerEx.init(s) // 玩家当前信息初始化
playerEx.score = sceneEx.DbGameFree.GetBaseScore() // 底注 playerEx.score = sceneEx.GetDBGameFree().GetBaseScore() // 底注
sceneEx.players[p.SnId] = playerEx sceneEx.players[p.SnId] = playerEx
p.ExtraData = playerEx p.ExtraData = playerEx
AvengersSendRoomInfo(s, p, sceneEx, playerEx, nil) AvengersSendRoomInfo(s, p, sceneEx, playerEx, nil)
@ -229,14 +229,14 @@ func (this *ScenePolicyAvengers) GetJackPotVal(s *base.Scene) int64 {
func AvengersSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *AvengersSceneData, playerEx *AvengersPlayerData, data *avengers.GameBilledData) { func AvengersSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *AvengersSceneData, playerEx *AvengersPlayerData, data *avengers.GameBilledData) {
logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId) logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId)
pack := &avengers.SCAvengersRoomInfo{ pack := &avengers.SCAvengersRoomInfo{
RoomId: proto.Int(s.SceneId), RoomId: s.SceneId,
Creator: proto.Int32(s.Creator), Creator: proto.Int32(s.Creator),
GameId: proto.Int(s.GameId), GameId: s.GameId,
RoomMode: proto.Int(s.GameMode), RoomMode: s.GameMode,
Params: common.CopySliceInt64ToInt32(s.Params), Params: common.CopySliceInt64ToInt32(s.Params),
State: proto.Int(s.SceneState.GetState()), State: proto.Int(s.SceneState.GetState()),
Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK), Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK),
GameFreeId: proto.Int32(s.DbGameFree.Id), GameFreeId: proto.Int32(s.GetDBGameFree().Id),
BilledData: data, BilledData: data,
} }
if playerEx != nil { if playerEx != nil {
@ -252,7 +252,7 @@ func AvengersSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *AvengersSceneD
pack.Players = append(pack.Players, pd) pack.Players = append(pack.Players, pd)
pack.BetLines = playerEx.betLines pack.BetLines = playerEx.betLines
pack.FreeTimes = proto.Int32(playerEx.freeTimes) pack.FreeTimes = proto.Int32(playerEx.freeTimes)
pack.Chip = proto.Int32(s.DbGameFree.BaseScore) pack.Chip = proto.Int32(s.GetDBGameFree().BaseScore)
pack.SpinID = proto.Int64(playerEx.spinID) pack.SpinID = proto.Int64(playerEx.spinID)
if playerEx.totalPriceBonus > 0 { if playerEx.totalPriceBonus > 0 {
switch playerEx.bonusStage { switch playerEx.bonusStage {
@ -367,8 +367,8 @@ func (this *SceneStateAvengersStart) OnPlayerOp(s *base.Scene, p *base.Player, o
return false return false
} }
//先做底注校验 //先做底注校验
if sceneEx.DbGameFree.GetBaseScore() != int32(params[0]) { if sceneEx.GetDBGameFree().GetBaseScore() != int32(params[0]) {
logger.Logger.Warnf("avengers snid[%v] opcode[%v] params[%v] BaseScore[%v]", p.SnId, opcode, params, sceneEx.DbGameFree.GetBaseScore()) logger.Logger.Warnf("avengers snid[%v] opcode[%v] params[%v] BaseScore[%v]", p.SnId, opcode, params, sceneEx.GetDBGameFree().GetBaseScore())
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, avengers.OpResultCode_OPRC_Error, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, avengers.OpResultCode_OPRC_Error, params)
return false return false
} }
@ -405,7 +405,7 @@ func (this *SceneStateAvengersStart) OnPlayerOp(s *base.Scene, p *base.Player, o
if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin { if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin {
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, avengers.OpResultCode_OPRC_CoinNotEnough, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, avengers.OpResultCode_OPRC_CoinNotEnough, params)
return false return false
} else if playerEx.freeTimes <= 0 && int64(sceneEx.DbGameFree.GetBetLimit()) > playerEx.Coin { //押注限制 } else if playerEx.freeTimes <= 0 && int64(sceneEx.GetDBGameFree().GetBetLimit()) > playerEx.Coin { //押注限制
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, avengers.OpResultCode_OPRC_CoinNotEnough, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, avengers.OpResultCode_OPRC_CoinNotEnough, params)
return false return false
} }
@ -419,7 +419,7 @@ func (this *SceneStateAvengersStart) OnPlayerOp(s *base.Scene, p *base.Player, o
//获取当前水池的上下文环境 //获取当前水池的上下文环境
sceneEx.CpCtx = base.CoinPoolMgr.GetCoinPoolCtx(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId) sceneEx.CpCtx = base.CoinPoolMgr.GetCoinPoolCtx(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId)
//税收比例 //税收比例
taxRate := sceneEx.DbGameFree.GetTaxRate() taxRate := sceneEx.GetDBGameFree().GetTaxRate()
if taxRate < 0 || taxRate > 10000 { if taxRate < 0 || taxRate > 10000 {
logger.Logger.Warnf("AvengersErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate) logger.Logger.Warnf("AvengersErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate)
taxRate = 500 taxRate = 500
@ -448,8 +448,8 @@ func (this *SceneStateAvengersStart) OnPlayerOp(s *base.Scene, p *base.Player, o
prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额 prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额
// 奖池参数 // 奖池参数
jackpotParams := sceneEx.DbGameFree.GetJackpot() jackpotParams := sceneEx.GetDBGameFree().GetJackpot()
var jackpotInit = int64(jackpotParams[rule.AVENGERS_JACKPOT_InitJackpot]) * int64(sceneEx.DbGameFree.GetBaseScore()) //奖池初始值 var jackpotInit = int64(jackpotParams[rule.AVENGERS_JACKPOT_InitJackpot]) * int64(sceneEx.GetDBGameFree().GetBaseScore()) //奖池初始值
var jackpotFundAdd, prizeFundAdd int64 //奖池/水池增量 var jackpotFundAdd, prizeFundAdd int64 //奖池/水池增量
if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注 if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注
@ -469,7 +469,7 @@ func (this *SceneStateAvengersStart) OnPlayerOp(s *base.Scene, p *base.Player, o
////统计参与游戏次数 ////统计参与游戏次数
//if !sceneEx.Testing && !playerEx.IsRob { //if !sceneEx.Testing && !playerEx.IsRob {
// pack := &server.GWSceneEnd{ // pack := &server.GWSceneEnd{
// GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()), // GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
// Players: []*server.PlayerCtx{&server.PlayerCtx{SnId: proto.Int32(playerEx.SnId), Coin: proto.Int64(playerEx.Coin)}}, // Players: []*server.PlayerCtx{&server.PlayerCtx{SnId: proto.Int32(playerEx.SnId), Coin: proto.Int64(playerEx.Coin)}},
// } // }
// proto.SetDefaults(pack) // proto.SetDefaults(pack)
@ -668,7 +668,7 @@ func (this *SceneStateAvengersStart) OnPlayerOp(s *base.Scene, p *base.Player, o
case AvengersPlayerHistory: case AvengersPlayerHistory:
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
spinid := strconv.Itoa(int(playerEx.SnId)) spinid := strconv.Itoa(int(playerEx.SnId))
gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.DbGameFree.GetGameClass(), s.GameId) //复仇者联盟存储个人操作记录不分场次,因为选场界面也需要拉去个人操作记录 gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.GetDBGameFree().GetGameClass(), int(s.GameId)) //复仇者联盟存储个人操作记录不分场次,因为选场界面也需要拉去个人操作记录
pack := &avengers.SCAvengersPlayerHistory{} pack := &avengers.SCAvengersPlayerHistory{}
for _, v := range gpl.Data { for _, v := range gpl.Data {
if v.GameDetailedLogId == "" { if v.GameDetailedLogId == "" {
@ -806,7 +806,7 @@ func (this *SceneStateAvengersStart) BenchTest(s *base.Scene, p *base.Player) {
file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,爆奖,中线倍数,中线数,剩余免费次数\r\n") file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,爆奖,中线倍数,中线数,剩余免费次数\r\n")
oldCoin := p.Coin oldCoin := p.Coin
p.Coin = 5000 * int64(s.DbGameFree.GetBaseScore()) p.Coin = 5000 * int64(s.GetDBGameFree().GetBaseScore())
if playerEx, ok := p.ExtraData.(*AvengersPlayerData); ok { if playerEx, ok := p.ExtraData.(*AvengersPlayerData); ok {
for i := 0; i < BENCH_CNT; i++ { for i := 0; i < BENCH_CNT; i++ {
startCoin := p.Coin startCoin := p.Coin
@ -817,7 +817,7 @@ func (this *SceneStateAvengersStart) BenchTest(s *base.Scene, p *base.Player) {
inCoin := int64(playerEx.RollGameType.BaseResult.TotalBet) inCoin := int64(playerEx.RollGameType.BaseResult.TotalBet)
outCoin := playerEx.RollGameType.BaseResult.ChangeCoin + inCoin outCoin := playerEx.RollGameType.BaseResult.ChangeCoin + inCoin
taxCoin := playerEx.RollGameType.BaseResult.Tax taxCoin := playerEx.RollGameType.BaseResult.Tax
lineScore := float64(playerEx.RollGameType.BaseResult.WinRate*s.DbGameFree.GetBaseScore()) * float64(10000.0-s.DbGameFree.GetTaxRate()) / 10000.0 lineScore := float64(playerEx.RollGameType.BaseResult.WinRate*s.GetDBGameFree().GetBaseScore()) * float64(10000.0-s.GetDBGameFree().GetTaxRate()) / 10000.0
jackpotScore := outCoin - playerEx.RollGameType.BaseResult.ChangeCoin - int64(lineScore+0.00001) jackpotScore := outCoin - playerEx.RollGameType.BaseResult.ChangeCoin - int64(lineScore+0.00001)
str := fmt.Sprintf("%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v\r\n", p.SnId, poolCoin, startCoin, p.Coin, inCoin, outCoin, taxCoin, str := fmt.Sprintf("%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v\r\n", p.SnId, poolCoin, startCoin, p.Coin, inCoin, outCoin, taxCoin,
@ -860,7 +860,7 @@ func (this *SceneStateAvengersStart) WinTargetBenchTest(s *base.Scene, p *base.P
} }
file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,爆奖,中线倍数,中线数,剩余免费次数\r\n") file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,爆奖,中线倍数,中线数,剩余免费次数\r\n")
oldCoin := p.Coin oldCoin := p.Coin
switch s.DbGameFree.GetSceneType() { switch s.GetDBGameFree().GetSceneType() {
case 1: case 1:
p.Coin = 100000 p.Coin = 100000
case 2: case 2:
@ -883,7 +883,7 @@ func (this *SceneStateAvengersStart) WinTargetBenchTest(s *base.Scene, p *base.P
inCoin := int64(playerEx.RollGameType.BaseResult.TotalBet) inCoin := int64(playerEx.RollGameType.BaseResult.TotalBet)
outCoin := playerEx.RollGameType.BaseResult.ChangeCoin + inCoin outCoin := playerEx.RollGameType.BaseResult.ChangeCoin + inCoin
taxCoin := playerEx.RollGameType.BaseResult.Tax taxCoin := playerEx.RollGameType.BaseResult.Tax
lineScore := float64(playerEx.RollGameType.BaseResult.WinRate*s.DbGameFree.GetBaseScore()) * float64(10000.0-s.DbGameFree.GetTaxRate()) / 10000.0 lineScore := float64(playerEx.RollGameType.BaseResult.WinRate*s.GetDBGameFree().GetBaseScore()) * float64(10000.0-s.GetDBGameFree().GetTaxRate()) / 10000.0
jackpotScore := outCoin - playerEx.RollGameType.BaseResult.WinSmallGame - int64(lineScore+0.00001) jackpotScore := outCoin - playerEx.RollGameType.BaseResult.WinSmallGame - int64(lineScore+0.00001)
str := fmt.Sprintf("%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v\r\n", p.SnId, poolCoin, startCoin, p.Coin, inCoin, outCoin, taxCoin, str := fmt.Sprintf("%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v\r\n", p.SnId, poolCoin, startCoin, p.Coin, inCoin, outCoin, taxCoin,
@ -915,7 +915,7 @@ func AvengersCheckAndSaveLog(sceneEx *AvengersSceneData, playerEx *AvengersPlaye
//log2 //log2
playerEx.RollGameType.BaseResult.ChangeCoin = changeCoin playerEx.RollGameType.BaseResult.ChangeCoin = changeCoin
playerEx.RollGameType.BaseResult.BasicBet = sceneEx.DbGameFree.GetBaseScore() playerEx.RollGameType.BaseResult.BasicBet = sceneEx.GetDBGameFree().GetBaseScore()
playerEx.RollGameType.BaseResult.RoomId = int32(sceneEx.SceneId) playerEx.RollGameType.BaseResult.RoomId = int32(sceneEx.SceneId)
playerEx.RollGameType.BaseResult.AfterCoin = playerEx.Coin playerEx.RollGameType.BaseResult.AfterCoin = playerEx.Coin
playerEx.RollGameType.BaseResult.BeforeCoin = startCoin playerEx.RollGameType.BaseResult.BeforeCoin = startCoin
@ -974,8 +974,8 @@ func AvengersCheckAndSaveLog(sceneEx *AvengersSceneData, playerEx *AvengersPlaye
GameCoinTs: proto.Int64(playerEx.GameCoinTs), GameCoinTs: proto.Int64(playerEx.GameCoinTs),
} }
gwPlayerBet := &server.GWPlayerData{ gwPlayerBet := &server.GWPlayerData{
SceneId: proto.Int(sceneEx.SceneId), SceneId: sceneEx.SceneId,
GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()), GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
} }
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet) gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
sceneEx.SyncPlayerDatas(&base.PlayerDataParam{ sceneEx.SyncPlayerDatas(&base.PlayerDataParam{

View File

@ -2,5 +2,5 @@ package base
// 提供税收和流水,根据代理需求后台进行分账 // 提供税收和流水,根据代理需求后台进行分账
func ProfitDistribution(p *Player, tax, taxex, validFlow int64) { func ProfitDistribution(p *Player, tax, taxex, validFlow int64) {
//LogChannelSingleton.WriteMQData(model.GenerateTaxDivide(p.SnId, p.Platform, p.Channel, p.BeUnderAgentCode, p.PackageID, tax, taxex, validFlow, p.scene.GameId, p.scene.GameMode, p.scene.DbGameFree.GetId(), p.PromoterTree)) //LogChannelSingleton.WriteMQData(model.GenerateTaxDivide(p.SnId, p.Platform, p.Channel, p.BeUnderAgentCode, p.PackageID, tax, taxex, validFlow, p.scene.GameId, p.scene.GameMode, p.scene.GetDBGameFree().GetId(), p.PromoterTree))
} }

View File

@ -246,7 +246,7 @@ func (this *Player) SyncFlagToWorld() {
} }
pack := &server.GWPlayerFlag{ pack := &server.GWPlayerFlag{
SnId: proto.Int32(this.SnId), SnId: proto.Int32(this.SnId),
RoomId: proto.Int(this.scene.SceneId), RoomId: this.scene.SceneId,
Flag: proto.Int(this.flag), Flag: proto.Int(this.flag),
} }
proto.SetDefaults(pack) proto.SetDefaults(pack)
@ -621,7 +621,7 @@ func (this *Player) ReportGameEvent(tax, taxex, changeCoin, validbet, validFlow,
gamingTime := int32(time.Now().Sub(this.scene.GameNowTime).Seconds()) gamingTime := int32(time.Now().Sub(this.scene.GameNowTime).Seconds())
LogChannelSingleton.WriteMQData(model.GenerateGameEvent(model.CreatePlayerGameRecEvent(this.SnId, tax, taxex, changeCoin, validbet, validFlow, in, out, LogChannelSingleton.WriteMQData(model.GenerateGameEvent(model.CreatePlayerGameRecEvent(this.SnId, tax, taxex, changeCoin, validbet, validFlow, in, out,
int32(this.scene.GameId), this.scene.DbGameFree.GetId(), int32(this.scene.GameMode), int32(this.scene.GameId), this.scene.GetGameFreeId(), int32(this.scene.GameMode),
this.scene.GetRecordId(), this.Channel, this.BeUnderAgentCode, this.Platform, this.City, this.DeviceOS, this.scene.GetRecordId(), this.Channel, this.BeUnderAgentCode, this.Platform, this.City, this.DeviceOS,
this.CreateTime, gamingTime, gameFirstTime, gameFreeFirstTime, gameTimes, gameFreeTimes, this.LastLoginTime, this.CreateTime, gamingTime, gameFirstTime, gameFreeFirstTime, gameTimes, gameFreeTimes, this.LastLoginTime,
this.TelephonePromoter, this.DeviceId))) this.TelephonePromoter, this.DeviceId)))

View File

@ -55,9 +55,9 @@ func (this *PlayerMgr) AddPlayer(id int64, data []byte, ws, gs *netlib.Session)
logger.Logger.Warnf("(this *PlayerMgr) AddPlayer found id=%v player exist snid=%v", id, oldPlayer.SnId) logger.Logger.Warnf("(this *PlayerMgr) AddPlayer found id=%v player exist snid=%v", id, oldPlayer.SnId)
testFlag = true testFlag = true
if oldPlayer.scene != nil { if oldPlayer.scene != nil {
logger.Logger.Warnf("(this *PlayerMgr) AddPlayer found snid=%v in sceneid=%v", id, oldPlayer.SnId, oldPlayer.scene.SceneId) logger.Logger.Warnf("(this *PlayerMgr) AddPlayer found id=%v snid=%v in sceneid=%v", id, oldPlayer.SnId, oldPlayer.scene.SceneId)
if SceneMgrSington.GetScene(oldPlayer.scene.SceneId) != nil { if SceneMgrSington.GetScene(int(oldPlayer.scene.SceneId)) != nil {
logger.Logger.Warnf("(this *PlayerMgr) AddPlayer found snid=%v in sceneid=%v SceneMgrSington.GetScene(oldPlayer.scene.sceneId) != nil", id, oldPlayer.SnId, oldPlayer.scene.SceneId) logger.Logger.Warnf("(this *PlayerMgr) AddPlayer found id=%v snid=%v in sceneid=%v SceneMgrSington.GetScene(oldPlayer.scene.sceneId) != nil", id, oldPlayer.SnId, oldPlayer.scene.SceneId)
} }
} }
this.DelPlayer(id) this.DelPlayer(id)

View File

@ -13,11 +13,6 @@ import (
"mongo.games.com/goserver/core/netlib" "mongo.games.com/goserver/core/netlib"
) )
const (
ReplayServerType int = 8
ReplayServerId = 801
)
var _replayIgnorePacketIds = map[int]bool{} var _replayIgnorePacketIds = map[int]bool{}
type ReplayRecorder struct { type ReplayRecorder struct {
@ -97,13 +92,13 @@ func (this *ReplayRecorder) Fini(s *Scene) {
// todo dev // todo dev
//Rec: this.rs, //Rec: this.rs,
LogId: proto.String(this.Logid), LogId: proto.String(this.Logid),
GameId: proto.Int32(s.DbGameFree.GetGameId()), GameId: int32(s.GetGameId()),
RoomMode: proto.Int32(s.DbGameFree.GetGameMode()), RoomMode: int32(s.GetGameMode()),
NumOfGames: proto.Int(s.NumOfGames), NumOfGames: proto.Int(s.NumOfGames),
Platform: proto.String(s.Platform), Platform: proto.String(s.Platform),
DatasVer: proto.Int32(s.rrVer), DatasVer: proto.Int32(s.rrVer),
GameFreeid: proto.Int32(s.GetGameFreeId()), GameFreeid: proto.Int32(s.GetGameFreeId()),
RoomId: proto.Int(s.SceneId), RoomId: s.SceneId,
} }
if s.ClubId != 0 { if s.ClubId != 0 {
pack.ClubId = proto.Int32(s.ClubId) pack.ClubId = proto.Int32(s.ClubId)

View File

@ -11,7 +11,6 @@ import (
"mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/netlib" "mongo.games.com/goserver/core/netlib"
"mongo.games.com/goserver/core/timer"
"mongo.games.com/goserver/core/utils" "mongo.games.com/goserver/core/utils"
srvlibproto "mongo.games.com/goserver/srvlib/protocol" srvlibproto "mongo.games.com/goserver/srvlib/protocol"
@ -37,163 +36,96 @@ type CanRebindSnId interface {
RebindPlayerSnId(oldSnId, newSnId int32) RebindPlayerSnId(oldSnId, newSnId int32)
} }
type ItemInfo struct { // todo 结构优化
Id int32
Num int64
}
type Scene struct { type Scene struct {
ws *netlib.Session // 大厅服 *server.WGCreateScene
Rand *rand.Rand // 随机数生成器 ws *netlib.Session // 大厅服
ExtraData interface{} // 房间数据 Rand *rand.Rand // 随机数生成器
matchData interface{} // 比赛房数据 ExtraData interface{} // 房间数据
aiMgr AIMgr // aiMgr AIMgr //
WithLocalAI bool // WithLocalAI bool //
SceneId int // 房间id
GameId int // 游戏模式id
GameMode int // 弃用了,都是0
SceneMode int // 房间模式,如:公共房间 common.SceneMode_Public
SceneType int // 场次,新手场,中级场...
Platform string // 平台id
Params []int64
Creator int32
agentor int32
hallId int32
replayCode string
disbandGen int //第几次解散申请 disbandGen int //第几次解散申请
disbandParam []int64 //解散参数 disbandParam []int64 //解散参数
disbandPos int32 //发起解散的玩家位置 disbandPos int32 //发起解散的玩家位置
disbandTs int64 //解散发起时间戳 disbandTs int64 //解散发起时间戳
playerNum int //游戏人数
realPlayerNum int //真实玩家人数 realPlayerNum int //真实玩家人数
robotNum int //机器人数量 robotNum int //机器人数量
robotLimit int //最大限制机器人数量 robotLimit int //最大限制机器人数量
robotNumLastInvite int //上次邀请机器人时的数量 robotNumLastInvite int //上次邀请机器人时的数量
TotalOfGames int //游戏总局数
NumOfGames int //局数 NumOfGames int //局数
Players map[int32]*Player //参与者 Players map[int32]*Player //参与者
audiences map[int32]*Player //观众 audiences map[int32]*Player //观众
sp ScenePolicy //场景游戏策略 sp ScenePolicy //场景游戏策略
//mp MatchPolicy //场景比赛策略 rr *ReplayRecorder //回放记录器
rr *ReplayRecorder //回放记录器 rrVer int32 //录像的协议版本号
rrVer int32 //录像的协议版本号 SceneState SceneState //场景状态
DbGameFree *server.DB_GameFree //自由场数据 StateStartTime time.Time //状态开始时间
SceneState SceneState //场景状态 stateEndTime time.Time //状态结束时间
hDisband timer.TimerHandle //解散handle GameStartTime time.Time //游戏开始计时时间
StateStartTime time.Time //状态开始时间 GameNowTime time.Time //当局游戏开始时间
stateEndTime time.Time //状态结束时间 nextInviteTime time.Time //下次邀请机器人时间
GameStartTime time.Time //游戏开始计时时间 inviteInterval int64 //邀请间隔
GameNowTime time.Time //当局游戏开始时间 pause bool
nextInviteTime time.Time //下次邀请机器人时间 Gaming bool
inviteInterval int64 //邀请间隔 destroyed bool
pause bool completed bool
Gaming bool Testing bool //是否为测试场
destroyed bool graceDestroy bool //等待销毁
completed bool replayAddId int32
Testing bool //是否为测试场 KeyGameId string //游戏类型唯一ID
graceDestroy bool //等待销毁 KeyGamefreeId string //游戏场次唯一id
replayAddId int32 KeyGameDif string
KeyGameId string //游戏类型唯一ID GroupId int32 //分组id
KeyGamefreeId string //游戏场次唯一id bEnterAfterStart bool //是否允许中途加入
KeyGameDif string ClubId int32
GroupId int32 //分组id RoomId string //俱乐部那个包间
bEnterAfterStart bool //是否允许中途加入 RoomPos int32 //房间桌号
ClubId int32 PumpCoin int32 //抽水比例,同一个俱乐部下面的抽水比例是一定的,百分比
RoomId string //俱乐部那个包间 DealyTime int64 //结算延时时间
RoomPos int32 //房间桌号 CpCtx model.CoinPoolCtx //水池环境
PumpCoin int32 //抽水比例,同一个俱乐部下面的抽水比例是一定的,百分比 CpControlled bool //被水池控制了
DealyTime int64 //结算延时时间 timerRandomRobot int64
CpCtx model.CoinPoolCtx //水池环境 nogDismiss int //检查机器人离场时的局数(同一局只检查一次)
CpControlled bool //被水池控制了 SystemCoinOut int64 //本局游戏机器人营收 机器人赢:正值 机器人输:负值
timerRandomRobot int64 ChessRank []int32
nogDismiss int //检查机器人离场时的局数(同一局只检查一次) RealCtrl bool
//playerStatement map[int32]*webapi.PlayerStatement //玩家流水记录 CycleID string
SystemCoinOut int64 //本局游戏机器人营收 机器人赢:正值 机器人输:负值
ChessRank []int32
Items []*ItemInfo
BaseScore int32 //tienlen游戏底分
MatchId int64 //标记本次比赛的id并不是后台id
MatchFinals bool //比赛场决赛
MatchRound int64
MatchCurPlayerNum int64
MatchNextNeed int64
MatchType int64 // 0.普通场 1.锦标赛 2.冠军赛 3.vip专属
RealCtrl bool
CycleID string
} }
func NewScene(ws *netlib.Session, sceneId, gameMode, sceneMode, gameId int, platform string, params []int64, func NewScene(args *CreateSceneParam) *Scene {
agentor, creator int32, replayCode string, hallId, groupId, totalOfGames int32, dbGameFree *server.DB_GameFree, gameId := int(args.GetGameId())
bEnterAfterStart bool, baseScore int32, playerNum int, cherank []int32) *Scene { gameMode := int(args.GetGameMode())
sp := GetScenePolicy(gameId, gameMode) sp := GetScenePolicy(gameId, gameMode)
if sp == nil { if sp == nil {
logger.Logger.Errorf("Game id %v not register in ScenePolicyPool.", gameId) logger.Logger.Errorf("Game id %v not register in ScenePolicyPool.", gameId)
return nil return nil
} }
tNow := time.Now() tNow := time.Now()
s := &Scene{ s := &Scene{
ws: ws, WGCreateScene: args.WGCreateScene,
SceneId: sceneId, ws: args.Session,
GameId: gameId,
GameMode: gameMode,
SceneMode: sceneMode,
SceneType: int(dbGameFree.GetSceneType()),
Params: params,
Creator: creator,
replayCode: replayCode,
Players: make(map[int32]*Player), Players: make(map[int32]*Player),
audiences: make(map[int32]*Player), audiences: make(map[int32]*Player),
sp: sp, sp: sp,
hDisband: timer.TimerHandle(0),
GameStartTime: tNow, GameStartTime: tNow,
hallId: hallId,
Platform: platform,
DbGameFree: dbGameFree,
inviteInterval: model.GameParamData.RobotInviteInitInterval, inviteInterval: model.GameParamData.RobotInviteInitInterval,
GroupId: groupId, bEnterAfterStart: args.GetEnterAfterStart(),
bEnterAfterStart: bEnterAfterStart, ChessRank: args.GetChessRank(),
TotalOfGames: int(totalOfGames), KeyGameId: strconv.Itoa(int(args.GetGameId())),
BaseScore: baseScore, KeyGamefreeId: strconv.Itoa(int(args.GetDBGameFree().GetId())),
playerNum: playerNum, KeyGameDif: args.GetDBGameFree().GetGameDif(),
ChessRank: cherank,
} }
s.CycleID, _ = model.AutoIncGameLogId() s.CycleID, _ = model.AutoIncGameLogId()
if s != nil && s.init() { s.init()
logger.Logger.Trace("NewScene init success.") return s
if !s.Testing {
s.rrVer = ReplayRecorderVer[gameId]
s.RecordReplayStart()
}
return s
} else {
logger.Logger.Trace("NewScene init failed.")
return nil
}
} }
//func (this *Scene) BindAIMgr(aimgr AIMgr) { func (this *Scene) GetSceneType() int32 {
// this.aiMgr = aimgr if this.GetDBGameFree() != nil {
//} return this.GetDBGameFree().GetSceneType()
// 根据gamedifid转为gameid,然后返回所有的相同gameid的数据
func (this *Scene) GetTotalTodayDaliyGameData(keyGameId string, pd *Player) *model.PlayerGameStatics {
todayData := model.NewPlayerGameStatics()
if pd.TodayGameData == nil {
return todayData
} }
return 0
if pd.TodayGameData.CtrlData == nil {
return todayData
}
if info, ok := pd.TodayGameData.CtrlData[keyGameId]; ok {
todayData.TotalIn += info.TotalIn
todayData.TotalOut += info.TotalOut
}
return todayData
} }
func (this *Scene) RebindPlayerSnId(oldSnId, newSnId int32) { func (this *Scene) RebindPlayerSnId(oldSnId, newSnId int32) {
@ -220,10 +152,6 @@ func (this *Scene) init() bool {
this.Rand = rand.New(rand.NewSource(sceneRandSeed)) this.Rand = rand.New(rand.NewSource(sceneRandSeed))
this.nextInviteTime = tNow.Add(time.Second * time.Duration(this.Rand.Int63n(model.GameParamData.RobotInviteInitInterval))) this.nextInviteTime = tNow.Add(time.Second * time.Duration(this.Rand.Int63n(model.GameParamData.RobotInviteInitInterval)))
this.RandRobotCnt() this.RandRobotCnt()
this.KeyGameId = strconv.Itoa(int(this.DbGameFree.GetGameId()))
this.KeyGamefreeId = strconv.Itoa(int(this.DbGameFree.GetId()))
this.KeyGameDif = this.DbGameFree.GetGameDif()
return true return true
} }
@ -236,22 +164,13 @@ func (this *Scene) GetParam(idx int) int64 {
} }
func (this *Scene) GetBetMap() []int64 { func (this *Scene) GetBetMap() []int64 {
return this.DbGameFree.GetOtherIntParams() return this.GetDBGameFree().GetOtherIntParams()
}
func (this *Scene) IsDisbanding() bool {
return this.hDisband != timer.TimerHandle(0)
} }
func (this *Scene) GetGameFreeId() int32 { func (this *Scene) GetGameFreeId() int32 {
return this.DbGameFree.Id return this.GetDBGameFree().GetId()
}
func (this *Scene) GetDBGameFree() *server.DB_GameFree {
return this.DbGameFree
}
func (this *Scene) GetPlatform() string {
return this.Platform
} }
func (this *Scene) GetKeyGameId() string { func (this *Scene) GetKeyGameId() string {
return this.KeyGameId return this.KeyGameId
} }
@ -259,10 +178,10 @@ func (this *Scene) SetKeyGameId(keyGameId string) {
this.KeyGameId = keyGameId this.KeyGameId = keyGameId
} }
func (this *Scene) GetSceneId() int { func (this *Scene) GetSceneId() int {
return this.SceneId return int(this.SceneId)
} }
func (this *Scene) SetSceneId(sceneId int) { func (this *Scene) SetSceneId(sceneId int) {
this.SceneId = sceneId this.SceneId = int32(sceneId)
} }
func (this *Scene) GetGroupId() int32 { func (this *Scene) GetGroupId() int32 {
return this.GroupId return this.GroupId
@ -283,22 +202,22 @@ func (this *Scene) SetSceneState(state SceneState) {
this.SceneState = state this.SceneState = state
} }
func (this *Scene) GetGameId() int { func (this *Scene) GetGameId() int {
return this.GameId return int(this.GameId)
} }
func (this *Scene) SetGameId(gameId int) { func (this *Scene) SetGameId(gameId int) {
this.GameId = gameId this.GameId = int32(gameId)
} }
func (this *Scene) GetPlayerNum() int { func (this *Scene) GetPlayerNum() int {
return this.playerNum return int(this.WGCreateScene.GetPlayerNum())
} }
func (this *Scene) SetPlayerNum(playerNum int) { func (this *Scene) SetPlayerNum(playerNum int) {
this.playerNum = playerNum this.PlayerNum = int32(playerNum)
} }
func (this *Scene) GetGameMode() int { func (this *Scene) GetGameMode() int {
return this.GameMode return int(this.GameMode)
} }
func (this *Scene) SetGameMode(gameMode int) { func (this *Scene) SetGameMode(gameMode int) {
this.GameMode = gameMode this.GameMode = int32(gameMode)
} }
func (this *Scene) GetGaming() bool { func (this *Scene) GetGaming() bool {
return this.Gaming return this.Gaming
@ -319,17 +238,15 @@ func (this *Scene) SetCreator(creator int32) {
this.Creator = creator this.Creator = creator
} }
func (this *Scene) GetSceneMode() int { func (this *Scene) GetSceneMode() int {
return this.SceneMode return int(this.SceneMode)
} }
func (this *Scene) SetSceneMode(sceneMode int) { func (this *Scene) SetSceneMode(sceneMode int) {
this.SceneMode = sceneMode this.SceneMode = int32(sceneMode)
} }
func (this *Scene) GetParams() []int64 { func (this *Scene) GetParams() []int64 {
return this.Params return this.Params
} }
func (this *Scene) SetParams(params []int64) {
this.Params = params
}
func (this *Scene) GetStateStartTime() time.Time { func (this *Scene) GetStateStartTime() time.Time {
return this.StateStartTime return this.StateStartTime
} }
@ -453,9 +370,9 @@ func (this *Scene) PlayerEnter(p *Player, isLoaded bool) {
p.scene = this p.scene = this
pack := &gamehall.SCEnterRoom{ pack := &gamehall.SCEnterRoom{
GameId: proto.Int(this.GameId), GameId: this.GameId,
ModeType: proto.Int(this.GameMode), ModeType: this.GameMode,
RoomId: proto.Int(this.SceneId), RoomId: this.SceneId,
OpRetCode: gamehall.OpResultCode_Game_OPRC_Sucess_Game, OpRetCode: gamehall.OpResultCode_Game_OPRC_Sucess_Game,
Params: []int32{}, Params: []int32{},
ClubId: proto.Int32(this.ClubId), ClubId: proto.Int32(this.ClubId),
@ -465,7 +382,7 @@ func (this *Scene) PlayerEnter(p *Player, isLoaded bool) {
if p.IsRob { if p.IsRob {
this.robotNum++ this.robotNum++
logger.Logger.Tracef("(this *Scene) PlayerEnter(%v) robot(%v) robotlimit(%v)", this.DbGameFree.GetName()+this.DbGameFree.GetTitle(), this.robotNum, this.robotLimit) logger.Logger.Tracef("(this *Scene) PlayerEnter(%v) robot(%v) robotlimit(%v)", this.GetDBGameFree().GetName()+this.GetDBGameFree().GetTitle(), this.robotNum, this.robotLimit)
} else { } else {
p.Trusteeship = 0 p.Trusteeship = 0
p.ValidCacheBetTotal = 0 p.ValidCacheBetTotal = 0
@ -482,7 +399,7 @@ func (this *Scene) PlayerEnter(p *Player, isLoaded bool) {
utils.RunPanicless(func() { this.sp.OnPlayerEnter(this, p) }) utils.RunPanicless(func() { this.sp.OnPlayerEnter(this, p) })
if p.WBLevel < 0 { if p.WBLevel < 0 {
WarningBlackPlayer(p.SnId, this.DbGameFree.Id) WarningBlackPlayer(p.SnId, this.GetDBGameFree().Id)
} }
this.ResetNextInviteTime() this.ResetNextInviteTime()
@ -501,7 +418,7 @@ func (this *Scene) PlayerLeave(p *Player, reason int, isBill bool) {
pack := &gamehall.SCLeaveRoom{ pack := &gamehall.SCLeaveRoom{
//OpRetCode: p.opCode, //protocol.OpResultCode_OPRC_Hundred_YouHadBetCannotLeave, //OpRetCode: p.opCode, //protocol.OpResultCode_OPRC_Hundred_YouHadBetCannotLeave,
OpRetCode: gamehall.OpResultCode_Game(p.OpCode), OpRetCode: gamehall.OpResultCode_Game(p.OpCode),
RoomId: proto.Int(this.SceneId), RoomId: this.SceneId,
} }
if pack.GetOpRetCode() == gamehall.OpResultCode_Game_OPRC_Sucess_Game { if pack.GetOpRetCode() == gamehall.OpResultCode_Game_OPRC_Sucess_Game {
//不能这么做,机器人有特殊判定 //不能这么做,机器人有特殊判定
@ -523,7 +440,7 @@ func (this *Scene) PlayerLeave(p *Player, reason int, isBill bool) {
//send world离开房间 //send world离开房间
pack := &server.GWPlayerLeave{ pack := &server.GWPlayerLeave{
RoomId: proto.Int(this.SceneId), RoomId: this.SceneId,
PlayerId: proto.Int32(p.SnId), PlayerId: proto.Int32(p.SnId),
Reason: proto.Int(reason), Reason: proto.Int(reason),
ServiceFee: proto.Int64(p.serviceFee), ServiceFee: proto.Int64(p.serviceFee),
@ -533,7 +450,7 @@ func (this *Scene) PlayerLeave(p *Player, reason int, isBill bool) {
LostTimes: proto.Int(p.lostTimes), LostTimes: proto.Int(p.lostTimes),
TotalConvertibleFlow: proto.Int64(p.TotalConvertibleFlow), TotalConvertibleFlow: proto.Int64(p.TotalConvertibleFlow),
ValidCacheBetTotal: proto.Int64(p.ValidCacheBetTotal), ValidCacheBetTotal: proto.Int64(p.ValidCacheBetTotal),
MatchId: this.MatchId, MatchId: this.GetMatch().GetMatchSortId(),
CurIsWin: proto.Int64(p.CurIsWin), // 负数:输 0平局 正数:赢 CurIsWin: proto.Int64(p.CurIsWin), // 负数:输 0平局 正数:赢
} }
matchRobotGrades := p.MatchRobotGrades matchRobotGrades := p.MatchRobotGrades
@ -551,7 +468,7 @@ func (this *Scene) PlayerLeave(p *Player, reason int, isBill bool) {
} }
pack.GameCoinTs = proto.Int64(p.GameCoinTs) pack.GameCoinTs = proto.Int64(p.GameCoinTs)
if !p.IsLocal { if !p.IsLocal {
data, err := p.MarshalData(this.GameId) data, err := p.MarshalData(int(this.GameId))
if err == nil { if err == nil {
pack.PlayerData = data pack.PlayerData = data
} }
@ -581,7 +498,7 @@ func (this *Scene) PlayerLeave(p *Player, reason int, isBill bool) {
} }
this.robotNum = num this.robotNum = num
} }
logger.Logger.Tracef("(this *Scene) PlayerLeave(%v) robot(%v) robotlimit(%v)", this.DbGameFree.GetName()+this.DbGameFree.GetTitle(), this.robotNum, this.robotLimit) logger.Logger.Tracef("(this *Scene) PlayerLeave(%v) robot(%v) robotlimit(%v)", this.GetDBGameFree().GetName()+this.GetDBGameFree().GetTitle(), this.robotNum, this.robotLimit)
} else { } else {
this.realPlayerNum-- this.realPlayerNum--
this.RandRobotCnt() this.RandRobotCnt()
@ -596,9 +513,9 @@ func (this *Scene) AudienceEnter(p *Player, isload bool) {
p.scene = this p.scene = this
p.MarkFlag(PlayerState_Audience) p.MarkFlag(PlayerState_Audience)
pack := &gamehall.SCEnterRoom{ pack := &gamehall.SCEnterRoom{
GameId: proto.Int(this.GameId), GameId: this.GameId,
ModeType: proto.Int(this.GameMode), ModeType: this.GameMode,
RoomId: proto.Int(this.SceneId), RoomId: this.SceneId,
OpRetCode: gamehall.OpResultCode_Game_OPRC_Sucess_Game, OpRetCode: gamehall.OpResultCode_Game_OPRC_Sucess_Game,
} }
proto.SetDefaults(pack) proto.SetDefaults(pack)
@ -618,7 +535,7 @@ func (this *Scene) AudienceLeave(p *Player, reason int) {
if !this.CanChangeCoinScene(p) { if !this.CanChangeCoinScene(p) {
pack := &gamehall.SCLeaveRoom{ pack := &gamehall.SCLeaveRoom{
OpRetCode: gamehall.OpResultCode_Game(p.OpCode), //protocol.OpResultCode_OPRC_Hundred_YouHadBetCannotLeave, OpRetCode: gamehall.OpResultCode_Game(p.OpCode), //protocol.OpResultCode_OPRC_Hundred_YouHadBetCannotLeave,
RoomId: proto.Int(this.SceneId), RoomId: this.SceneId,
} }
proto.SetDefaults(pack) proto.SetDefaults(pack)
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_LEAVEROOM), pack) p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_LEAVEROOM), pack)
@ -630,7 +547,7 @@ func (this *Scene) AudienceLeave(p *Player, reason int) {
delete(this.audiences, p.SnId) delete(this.audiences, p.SnId)
//send world离开房间 //send world离开房间
pack := &server.GWPlayerLeave{ pack := &server.GWPlayerLeave{
RoomId: proto.Int(this.SceneId), RoomId: this.SceneId,
PlayerId: proto.Int32(p.SnId), PlayerId: proto.Int32(p.SnId),
Reason: proto.Int(reason), Reason: proto.Int(reason),
TotalConvertibleFlow: proto.Int64(p.TotalConvertibleFlow), TotalConvertibleFlow: proto.Int64(p.TotalConvertibleFlow),
@ -738,11 +655,11 @@ func (this *Scene) PlayerRehold(snid int32, sid int64, gs *netlib.Session) {
func (this *Scene) PlayerReturn(p *Player, isLoaded bool) { func (this *Scene) PlayerReturn(p *Player, isLoaded bool) {
logger.Logger.Trace("(this *Scene) PlayerReturn") logger.Logger.Trace("(this *Scene) PlayerReturn")
pack := &gamehall.SCReturnRoom{ pack := &gamehall.SCReturnRoom{
RoomId: proto.Int(this.SceneId), RoomId: this.SceneId,
GameId: proto.Int(this.GameId), GameId: this.GameId,
ModeType: proto.Int(this.GameMode), ModeType: this.GameMode,
Params: common.CopySliceInt64ToInt32(this.Params), Params: common.CopySliceInt64ToInt32(this.Params),
HallId: proto.Int32(this.hallId), HallId: this.GetDBGameFree().GetId(),
IsLoaded: proto.Bool(isLoaded), IsLoaded: proto.Bool(isLoaded),
OpRetCode: gamehall.OpResultCode_Game_OPRC_Sucess_Game, OpRetCode: gamehall.OpResultCode_Game_OPRC_Sucess_Game,
ClubId: proto.Int32(this.ClubId), ClubId: proto.Int32(this.ClubId),
@ -964,7 +881,7 @@ func (this *Scene) Destroy(force bool) {
} }
isCompleted := this.sp.IsCompleted(this) || this.completed isCompleted := this.sp.IsCompleted(this) || this.completed
SceneMgrSington.DestroyScene(this.SceneId) SceneMgrSington.DestroyScene(int(this.SceneId))
pack := &server.GWDestroyScene{ pack := &server.GWDestroyScene{
SceneId: int64(this.SceneId), SceneId: int64(this.SceneId),
IsCompleted: isCompleted, IsCompleted: isCompleted,
@ -998,7 +915,7 @@ func (this *Scene) IsCustom() bool {
} }
func (this *Scene) IsFull() bool { func (this *Scene) IsFull() bool {
return len(this.Players) >= this.playerNum return len(this.Players) >= this.GetPlayerNum()
} }
// 大厅场 // 大厅场
@ -1017,15 +934,15 @@ func (this *Scene) IsHundredScene() bool {
} }
func (this *Scene) GetCoinSceneLowerThanKick() int64 { func (this *Scene) GetCoinSceneLowerThanKick() int64 {
if this.DbGameFree != nil { if this.GetDBGameFree() != nil {
return this.DbGameFree.GetLowerThanKick() return this.GetDBGameFree().GetLowerThanKick()
} }
return 0 return 0
} }
func (this *Scene) GetCoinSceneMaxCoinLimit() int64 { func (this *Scene) GetCoinSceneMaxCoinLimit() int64 {
if this.DbGameFree != nil { if this.GetDBGameFree() != nil {
return this.DbGameFree.GetMaxCoinLimit() return this.GetDBGameFree().GetMaxCoinLimit()
} }
return 0 return 0
} }
@ -1044,7 +961,7 @@ func (this *Scene) CoinInLimitLocal(coin int64) bool {
// NotCoinInLimitType 金额超出入场限额,返回踢出类型 // NotCoinInLimitType 金额超出入场限额,返回踢出类型
func (this *Scene) NotCoinInLimitType(coin int64) int { func (this *Scene) NotCoinInLimitType(coin int64) int {
if common.IsLocalGame(this.GameId) { if common.IsLocalGame(int(this.GameId)) {
minCoin := this.GetLimitCoin() minCoin := this.GetLimitCoin()
if minCoin != 0 && coin < minCoin { if minCoin != 0 && coin < minCoin {
return common.PlayerLeaveReason_Bekickout return common.PlayerLeaveReason_Bekickout
@ -1071,7 +988,7 @@ func (this *Scene) NotCoinInLimitType(coin int64) int {
// CoinInLimit 单入场限额检查 // CoinInLimit 单入场限额检查
func (this *Scene) CoinInLimit(coin int64) bool { func (this *Scene) CoinInLimit(coin int64) bool {
if common.IsLocalGame(this.GameId) { if common.IsLocalGame(int(this.GameId)) {
return this.CoinInLimitLocal(coin) return this.CoinInLimitLocal(coin)
} }
@ -1094,7 +1011,7 @@ func (this *Scene) GetLimitCoin() int64 {
limitCoin := int64(0) limitCoin := int64(0)
tmpIds := []int32{} tmpIds := []int32{}
for _, data := range srvdata.PBDB_CreateroomMgr.Datas.GetArr() { for _, data := range srvdata.PBDB_CreateroomMgr.Datas.GetArr() {
if int(data.GameId) == this.GameId && int(data.GameSite) == this.SceneType { if data.GameId == this.GameId && data.GameSite == this.GetDBGameFree().GetSceneType() {
betRange := data.GetBetRange() betRange := data.GetBetRange()
if len(betRange) == 0 { if len(betRange) == 0 {
continue continue
@ -1143,8 +1060,8 @@ func (this *Scene) CoinOverMaxLimit(coin int64, p *Player) bool {
} }
} }
} else { } else {
if this.DbGameFree != nil { if this.GetDBGameFree() != nil {
limit := this.DbGameFree.GetRobotLimitCoin() limit := this.GetDBGameFree().GetRobotLimitCoin()
if len(limit) >= 2 { if len(limit) >= 2 {
comp := common.RandInt(int(limit[0]), int(limit[1])) comp := common.RandInt(int(limit[0]), int(limit[1]))
if coin > int64(comp) { if coin > int64(comp) {
@ -1168,32 +1085,32 @@ func (this *Scene) CorrectBillCoin(coin, limit1, limit2 int64) int64 {
} }
func (this *Scene) GetCoinSceneServiceFee() int32 { func (this *Scene) GetCoinSceneServiceFee() int32 {
if this.DbGameFree != nil { if this.GetDBGameFree() != nil {
return this.DbGameFree.GetServiceFee() return this.GetDBGameFree().GetServiceFee()
} }
return 0 return 0
} }
func (this *Scene) GetCoinSceneTypeId() int32 { func (this *Scene) GetCoinSceneTypeId() int32 {
if this.DbGameFree != nil { if this.GetDBGameFree() != nil {
return this.DbGameFree.Id return this.GetDBGameFree().Id
} }
return 0 return 0
} }
func (this *Scene) GetCoinSceneName() string { func (this *Scene) GetCoinSceneName() string {
if this.DbGameFree != nil { if this.GetDBGameFree() != nil {
return this.DbGameFree.GetName() + this.DbGameFree.GetTitle() return this.GetDBGameFree().GetName() + this.GetDBGameFree().GetTitle()
} }
return "" return ""
} }
func (this *Scene) GetHundredSceneName() string { func (this *Scene) GetHundredSceneName() string {
if this.IsHundredScene() && this.DbGameFree != nil { if this.IsHundredScene() && this.GetDBGameFree() != nil {
if this.DbGameFree.GetName() == this.DbGameFree.GetTitle() { if this.GetDBGameFree().GetName() == this.GetDBGameFree().GetTitle() {
return this.DbGameFree.GetTitle() return this.GetDBGameFree().GetTitle()
} else { } else {
return this.DbGameFree.GetName() + this.DbGameFree.GetTitle() return this.GetDBGameFree().GetName() + this.GetDBGameFree().GetTitle()
} }
} }
return "" return ""
@ -1272,10 +1189,10 @@ func (this *Scene) SyncSceneState(state int) {
func (this *Scene) NotifySceneRoundStart(round int) { func (this *Scene) NotifySceneRoundStart(round int) {
pack := &server.GWSceneStart{ pack := &server.GWSceneStart{
RoomId: proto.Int(this.SceneId), RoomId: this.SceneId,
CurrRound: proto.Int(round), CurrRound: proto.Int(round),
Start: proto.Bool(true), Start: proto.Bool(true),
MaxRound: proto.Int(this.TotalOfGames), MaxRound: this.TotalOfGames,
} }
proto.SetDefaults(pack) proto.SetDefaults(pack)
this.SendToWorld(int(server.SSPacketID_PACKET_GW_SCENESTART), pack) this.SendToWorld(int(server.SSPacketID_PACKET_GW_SCENESTART), pack)
@ -1283,10 +1200,10 @@ func (this *Scene) NotifySceneRoundStart(round int) {
func (this *Scene) NotifySceneRoundPause() { func (this *Scene) NotifySceneRoundPause() {
pack := &server.GWSceneStart{ pack := &server.GWSceneStart{
RoomId: proto.Int(this.SceneId), RoomId: this.SceneId,
Start: proto.Bool(false), Start: proto.Bool(false),
CurrRound: proto.Int(this.NumOfGames), CurrRound: proto.Int(this.NumOfGames),
MaxRound: proto.Int(this.TotalOfGames), MaxRound: this.TotalOfGames,
} }
proto.SetDefaults(pack) proto.SetDefaults(pack)
this.SendToWorld(int(server.SSPacketID_PACKET_GW_SCENESTART), pack) this.SendToWorld(int(server.SSPacketID_PACKET_GW_SCENESTART), pack)
@ -1295,7 +1212,7 @@ func (this *Scene) NotifySceneRoundPause() {
func (this *Scene) SyncGameState(sec, bl int) { func (this *Scene) SyncGameState(sec, bl int) {
if this.SceneState != nil { if this.SceneState != nil {
pack := &server.GWGameState{ pack := &server.GWGameState{
SceneId: proto.Int(this.SceneId), SceneId: this.SceneId,
State: proto.Int(this.SceneState.GetState()), State: proto.Int(this.SceneState.GetState()),
Ts: proto.Int64(time.Now().Unix()), Ts: proto.Int64(time.Now().Unix()),
Sec: proto.Int(sec), Sec: proto.Int(sec),
@ -1309,8 +1226,8 @@ func (this *Scene) SyncGameState(sec, bl int) {
// SyncScenePlayer 游戏开始的时候同步防伙牌数据 // SyncScenePlayer 游戏开始的时候同步防伙牌数据
func (this *Scene) SyncScenePlayer() { func (this *Scene) SyncScenePlayer() {
pack := &server.GWScenePlayerLog{ pack := &server.GWScenePlayerLog{
GameId: proto.Int(this.GameId), GameId: this.GameId,
GameFreeId: proto.Int32(this.DbGameFree.GetId()), GameFreeId: proto.Int32(this.GetDBGameFree().GetId()),
} }
for _, value := range this.Players { for _, value := range this.Players {
if value.IsRob || !value.IsGameing() { if value.IsRob || !value.IsGameing() {
@ -1323,7 +1240,7 @@ func (this *Scene) SyncScenePlayer() {
func (this *Scene) RecordReplayStart() { func (this *Scene) RecordReplayStart() {
if !this.IsHundredScene() && !this.IsMatchScene() { if !this.IsHundredScene() && !this.IsMatchScene() {
logger.Logger.Trace("RecordReplayStart-----", this.replayCode, this.NumOfGames, this.replayAddId) logger.Logger.Trace("RecordReplayStart-----", this.GetReplayCode(), this.NumOfGames, this.replayAddId)
id := fmt.Sprintf("%d%d%v%d", this.GameId, this.SceneId, this.GameNowTime.Format(ReplayIdTf), this.replayAddId) id := fmt.Sprintf("%d%d%v%d", this.GameId, this.SceneId, this.GameNowTime.Format(ReplayIdTf), this.replayAddId)
this.rr = NewReplayRecorder(id) this.rr = NewReplayRecorder(id)
} }
@ -1331,7 +1248,7 @@ func (this *Scene) RecordReplayStart() {
func (this *Scene) RecordReplayOver() { func (this *Scene) RecordReplayOver() {
if !this.Testing && !this.IsHundredScene() && !this.IsMatchScene() { if !this.Testing && !this.IsHundredScene() && !this.IsMatchScene() {
logger.Logger.Trace("RecordReplayOver-----", this.replayCode, this.NumOfGames, this.replayAddId) logger.Logger.Trace("RecordReplayOver-----", this.GetReplayCode(), this.NumOfGames, this.replayAddId)
this.replayAddId++ this.replayAddId++
this.rr.Fini(this) this.rr.Fini(this)
@ -1370,7 +1287,7 @@ func (this *Scene) TryDismissRob(params ...int) {
this.nogDismiss = this.NumOfGames this.nogDismiss = this.NumOfGames
//如果是满桌并且是禁止匹配真人,那么保持满桌几局 //如果是满桌并且是禁止匹配真人,那么保持满桌几局
if this.DbGameFree.GetMatchTrueMan() == common.MatchTrueMan_Forbid && this.IsFull() && rand.Intn(4) == 1 { if this.GetDBGameFree().GetMatchTrueMan() == common.MatchTrueMan_Forbid && this.IsFull() && rand.Intn(4) == 1 {
hasLeave = true hasLeave = true
} }
@ -1386,7 +1303,7 @@ func (this *Scene) TryDismissRob(params ...int) {
} }
} }
if !hasLeave && this.DbGameFree.GetMatchTrueMan() != common.MatchTrueMan_Forbid && len(params) > 0 && if !hasLeave && this.GetDBGameFree().GetMatchTrueMan() != common.MatchTrueMan_Forbid && len(params) > 0 &&
params[0] == 1 && this.IsFull() && common.RandInt(10000) < 4000 { params[0] == 1 && this.IsFull() && common.RandInt(10000) < 4000 {
for _, r := range this.Players { for _, r := range this.Players {
if r.IsRob { if r.IsRob {
@ -1430,7 +1347,7 @@ func (this *Scene) TryDismissRob(params ...int) {
func (this *Scene) CreateGameRecPacket() *server.GWGameRec { func (this *Scene) CreateGameRecPacket() *server.GWGameRec {
return &server.GWGameRec{ return &server.GWGameRec{
RoomId: proto.Int(this.SceneId), RoomId: this.SceneId,
NumOfGames: proto.Int(this.NumOfGames), NumOfGames: proto.Int(this.NumOfGames),
GameTime: proto.Int(int(time.Now().Sub(this.GameStartTime) / time.Second)), GameTime: proto.Int(int(time.Now().Sub(this.GameStartTime) / time.Second)),
} }
@ -1507,7 +1424,7 @@ func (this *Scene) CoinPoolCanOut() bool {
if setting != nil { if setting != nil {
return int32(noRobotPlayerCount) >= setting.GetMinOutPlayerNum() return int32(noRobotPlayerCount) >= setting.GetMinOutPlayerNum()
} }
return int32(noRobotPlayerCount) >= this.dbGameFree.GetMinOutPlayerNum() return int32(noRobotPlayerCount) >= this.GetDBGameFree().GetMinOutPlayerNum()
*/ */
} }
@ -1531,8 +1448,8 @@ func (this *Scene) SaveGameDetailedLog(logid string, gamedetailednote string, ga
if this != nil { if this != nil {
if !this.Testing { //测试场屏蔽掉 if !this.Testing { //测试场屏蔽掉
trend20Lately := gameDetailedParam.Trend20Lately trend20Lately := gameDetailedParam.Trend20Lately
baseScore := this.DbGameFree.GetBaseScore() baseScore := this.GetDBGameFree().GetBaseScore()
if common.IsLocalGame(this.GameId) { if common.IsLocalGame(int(this.GameId)) {
baseScore = this.BaseScore baseScore = this.BaseScore
} }
if this.IsCoinScene() { if this.IsCoinScene() {
@ -1541,13 +1458,13 @@ func (this *Scene) SaveGameDetailedLog(logid string, gamedetailednote string, ga
if _, ok := mapPlatform[p.Platform]; !ok { if _, ok := mapPlatform[p.Platform]; !ok {
mapPlatform[p.Platform] = true mapPlatform[p.Platform] = true
log := model.NewGameDetailedLogEx(logid, int32(this.GameId), int32(this.SceneId), log := model.NewGameDetailedLogEx(logid, int32(this.GameId), int32(this.SceneId),
this.DbGameFree.GetGameMode(), this.DbGameFree.Id, int32(len(this.Players)), this.GetDBGameFree().GetGameMode(), this.GetDBGameFree().Id, int32(len(this.Players)),
int32(time.Now().Unix()-this.GameNowTime.Unix()), baseScore, int32(time.Now().Unix()-this.GameNowTime.Unix()), baseScore,
gamedetailednote, p.Platform, this.ClubId, this.RoomId, this.CpCtx, GameDetailedVer[this.GameId], trend20Lately, gamedetailednote, p.Platform, this.ClubId, this.RoomId, this.CpCtx, GameDetailedVer[int(this.GameId)], trend20Lately,
gameDetailedParam.CtrlType, gameDetailedParam.PlayerPool) gameDetailedParam.CtrlType, gameDetailedParam.PlayerPool)
if log != nil { if log != nil {
if this.IsMatchScene() { if this.IsMatchScene() {
log.MatchId = this.MatchId log.MatchId = this.GetMatch().GetMatchSortId()
} }
if this.IsCustom() { if this.IsCustom() {
log.CycleId = this.CycleID log.CycleId = this.CycleID
@ -1558,13 +1475,13 @@ func (this *Scene) SaveGameDetailedLog(logid string, gamedetailednote string, ga
} }
} else { } else {
log := model.NewGameDetailedLogEx(logid, int32(this.GameId), int32(this.SceneId), log := model.NewGameDetailedLogEx(logid, int32(this.GameId), int32(this.SceneId),
this.DbGameFree.GetGameMode(), this.DbGameFree.Id, int32(len(this.Players)), this.GetDBGameFree().GetGameMode(), this.GetDBGameFree().Id, int32(len(this.Players)),
int32(time.Now().Unix()-this.GameNowTime.Unix()), baseScore, int32(time.Now().Unix()-this.GameNowTime.Unix()), baseScore,
gamedetailednote, this.Platform, this.ClubId, this.RoomId, this.CpCtx, GameDetailedVer[this.GameId], trend20Lately, gamedetailednote, this.Platform, this.ClubId, this.RoomId, this.CpCtx, GameDetailedVer[int(this.GameId)], trend20Lately,
gameDetailedParam.CtrlType, gameDetailedParam.PlayerPool) gameDetailedParam.CtrlType, gameDetailedParam.PlayerPool)
if log != nil { if log != nil {
if this.IsMatchScene() { if this.IsMatchScene() {
log.MatchId = this.MatchId log.MatchId = this.GetMatch().GetMatchSortId()
} }
if this.IsCustom() { if this.IsCustom() {
log.CycleId = this.CycleID log.CycleId = this.CycleID
@ -1628,7 +1545,7 @@ func (this *Scene) SaveFriendRecord(snid int32, isWin int32, billCoin int64, bas
if this.SceneMode == common.SceneMode_Private { if this.SceneMode == common.SceneMode_Private {
return return
} }
log := model.NewFriendRecordLogEx(this.Platform, snid, isWin, int32(this.GameId), baseScore, billCoin, this.MatchType) log := model.NewFriendRecordLogEx(this.Platform, snid, isWin, this.GameId, baseScore, billCoin, int64(this.GetMatch().GetMatchType()))
if log != nil { if log != nil {
LogChannelSingleton.WriteLog(log) LogChannelSingleton.WriteLog(log)
} }
@ -1642,12 +1559,12 @@ func (this *Scene) SaveGamePlayerListLog(snid int32, param *SaveGamePlayerListLo
playerEx := this.GetPlayer(snid) playerEx := this.GetPlayer(snid)
//有些结算的时候玩家已经退场不要用是否在游戏0709修改为扣税后数值 //有些结算的时候玩家已经退场不要用是否在游戏0709修改为扣税后数值
if playerEx != nil && !param.IsLeave && !playerEx.IsRob && (param.IsFree || param.TotalIn != 0 || param.TotalOut != 0) { if playerEx != nil && !param.IsLeave && !playerEx.IsRob && (param.IsFree || param.TotalIn != 0 || param.TotalOut != 0) {
totalFlow := param.ValidFlow * int64(this.DbGameFree.GetBetWaterRate()) / 100 totalFlow := param.ValidFlow * int64(this.GetDBGameFree().GetBetWaterRate()) / 100
playerEx.TotalConvertibleFlow += totalFlow playerEx.TotalConvertibleFlow += totalFlow
playerEx.TotalFlow += totalFlow playerEx.TotalFlow += totalFlow
playerEx.ValidCacheBetTotal += param.ValidBet playerEx.ValidCacheBetTotal += param.ValidBet
//报表统计 //报表统计
//playerEx.SaveReportForm(int(this.DbGameFree.GetGameClass()), this.SceneMode, this.KeyGameId, //playerEx.SaveReportForm(int(this.GetDBGameFree().GetGameClass()), this.SceneMode, this.KeyGameId,
// param.WinAmountNoAnyTax, totalFlow, param.ValidBet) // param.WinAmountNoAnyTax, totalFlow, param.ValidBet)
//分配利润 //分配利润
ProfitDistribution(playerEx, param.TaxCoin, param.ClubPumpCoin, totalFlow) ProfitDistribution(playerEx, param.TaxCoin, param.ClubPumpCoin, totalFlow)
@ -1663,8 +1580,8 @@ func (this *Scene) SaveGamePlayerListLog(snid int32, param *SaveGamePlayerListLo
this.GameId == common.GameId_TamQuoc { //复仇者联盟强制为0所有场次操作记录放一起 this.GameId == common.GameId_TamQuoc { //复仇者联盟强制为0所有场次操作记录放一起
roomType = 0 roomType = 0
} }
baseScore := this.DbGameFree.GetBaseScore() baseScore := this.GetDBGameFree().GetBaseScore()
if common.IsLocalGame(this.GameId) { if common.IsLocalGame(int(this.GameId)) {
baseScore = this.BaseScore baseScore = this.BaseScore
} }
@ -1674,10 +1591,10 @@ func (this *Scene) SaveGamePlayerListLog(snid int32, param *SaveGamePlayerListLo
} }
log := model.NewGamePlayerListLogEx(snid, param.LogId, param.Platform, param.Channel, param.Promoter, param.PackageTag, log := model.NewGamePlayerListLogEx(snid, param.LogId, param.Platform, param.Channel, param.Promoter, param.PackageTag,
int32(this.GameId), baseScore, int32(this.SceneId), this.DbGameFree.GetGameMode(), this.GameId, baseScore, this.SceneId, int32(this.GetGameMode()),
this.GetGameFreeId(), param.TotalIn, param.TotalOut, this.ClubId, this.RoomId, param.TaxCoin, param.ClubPumpCoin, roomType, this.GetGameFreeId(), param.TotalIn, param.TotalOut, this.ClubId, this.RoomId, param.TaxCoin, param.ClubPumpCoin, roomType,
param.BetAmount, param.WinAmountNoAnyTax, this.KeyGameId, Name, this.DbGameFree.GetGameClass(), param.BetAmount, param.WinAmountNoAnyTax, this.KeyGameId, Name, this.GetDBGameFree().GetGameClass(),
param.IsFirstGame, this.MatchId, this.MatchType, param.IsFree, param.WinSmallGame, param.WinTotal) param.IsFirstGame, this.GetMatch().GetMatchSortId(), int64(this.GetMatch().GetMatchType()), param.IsFree, param.WinSmallGame, param.WinTotal)
if log != nil { if log != nil {
LogChannelSingleton.WriteLog(log) LogChannelSingleton.WriteLog(log)
} }
@ -1708,9 +1625,9 @@ func (this *Scene) RobotIsLimit() bool {
return true return true
} }
// 房间需要给真人留一个空位 // 房间需要给真人留一个空位
//if this.DbGameFree.GetMatchTrueMan() == common.MatchTrueMan_Priority && this.playerNum-this.realPlayerNum-1 <= this.robotNum { //if this.GetDBGameFree().GetMatchTrueMan() == common.MatchTrueMan_Priority && this.playerNum-this.realPlayerNum-1 <= this.robotNum {
// 没有真人的房间需要给真人留一个空位 // 没有真人的房间需要给真人留一个空位
if this.DbGameFree.GetMatchTrueMan() == common.MatchTrueMan_Priority && this.playerNum-1 <= this.robotNum { if this.GetDBGameFree().GetMatchTrueMan() == common.MatchTrueMan_Priority && this.GetPlayerNum()-1 <= this.robotNum {
return true return true
} }
} else if this.IsHundredScene() { } else if this.IsHundredScene() {
@ -1723,11 +1640,11 @@ func (this *Scene) RobotIsLimit() bool {
} }
func (this *Scene) RandRobotCnt() { func (this *Scene) RandRobotCnt() {
if this.DbGameFree != nil { if this.GetDBGameFree() != nil {
if this.DbGameFree.GetMatchMode() == 1 { if this.GetDBGameFree().GetMatchMode() == 1 {
return return
} }
numrng := this.DbGameFree.GetRobotNumRng() numrng := this.GetDBGameFree().GetRobotNumRng()
if len(numrng) >= 2 { if len(numrng) >= 2 {
if numrng[1] == numrng[0] { if numrng[1] == numrng[0] {
this.robotLimit = int(numrng[0]) this.robotLimit = int(numrng[0])
@ -1748,7 +1665,7 @@ func (this *Scene) GetRobotTime() int64 {
} }
func (this *Scene) IsPreCreateScene() bool { func (this *Scene) IsPreCreateScene() bool {
return this.DbGameFree.GetCreateRoomNum() > 0 return this.GetDBGameFree().GetCreateRoomNum() > 0
} }
func (this *Scene) TryInviteRobot() { func (this *Scene) TryInviteRobot() {
@ -1756,7 +1673,7 @@ func (this *Scene) TryInviteRobot() {
return return
} }
// 游戏配置错误 // 游戏配置错误
if this.DbGameFree == nil { if this.GetDBGameFree() == nil {
return return
} }
// 私有房间不邀请机器人,比赛场部邀请机器人 // 私有房间不邀请机器人,比赛场部邀请机器人
@ -1764,11 +1681,11 @@ func (this *Scene) TryInviteRobot() {
return return
} }
// 队列匹配不邀请机器人 // 队列匹配不邀请机器人
if this.DbGameFree.GetMatchMode() == 1 { if this.GetDBGameFree().GetMatchMode() == 1 {
return return
} }
// 不使用机器人 // 不使用机器人
if this.DbGameFree.GetBot() == 0 { //机器人不进的场 if this.GetDBGameFree().GetBot() == 0 { //机器人不进的场
return return
} }
@ -1782,7 +1699,7 @@ func (this *Scene) TryInviteRobot() {
return return
} }
switch this.DbGameFree.GetGameType() { switch this.GetDBGameFree().GetGameType() {
case common.GameType_Fishing: case common.GameType_Fishing:
if this.robotNum >= this.robotLimit { if this.robotNum >= this.robotLimit {
return return
@ -1818,8 +1735,8 @@ func (this *Scene) TryInviteRobot() {
} }
hadCnt := len(this.Players) hadCnt := len(this.Players)
robCnt = this.robotLimit - this.robotNum robCnt = this.robotLimit - this.robotNum
if robCnt > this.playerNum-hadCnt { if robCnt > this.GetPlayerNum()-hadCnt {
robCnt = this.playerNum - hadCnt robCnt = this.GetPlayerNum() - hadCnt
} }
} else if this.IsHundredScene() { } else if this.IsHundredScene() {
robCnt = this.robotLimit - this.robotNum robCnt = this.robotLimit - this.robotNum
@ -1830,7 +1747,7 @@ func (this *Scene) TryInviteRobot() {
return return
} }
hadCnt := len(this.Players) hadCnt := len(this.Players)
robCnt = this.playerNum - hadCnt robCnt = this.GetPlayerNum() - hadCnt
if this.realPlayerNum == 0 { //一个真人都没有,不让机器人坐满房间 if this.realPlayerNum == 0 { //一个真人都没有,不让机器人坐满房间
robCnt-- robCnt--
} }
@ -1838,7 +1755,7 @@ func (this *Scene) TryInviteRobot() {
} }
if robCnt > 0 { if robCnt > 0 {
var num int32 var num int32
if this.DbGameFree.GameId == common.GameId_ChesstitiansCambodianRobot { if this.GetDBGameFree().GameId == common.GameId_ChesstitiansCambodianRobot {
num = int32(robCnt) num = int32(robCnt)
} else { } else {
num = this.Rand.Int31n(int32(robCnt + 1)) num = this.Rand.Int31n(int32(robCnt + 1))
@ -1847,11 +1764,11 @@ func (this *Scene) TryInviteRobot() {
if this.IsCoinScene() /* && this.gaming*/ { //如果牌局正在进行中,一个一个进 if this.IsCoinScene() /* && this.gaming*/ { //如果牌局正在进行中,一个一个进
num = 1 num = 1
} }
//logger.Logger.Tracef("(this *Scene)(groupid:%v sceneid:%v) TryInviteRobot(%v) current robot(%v+%v) robotlimit(%v)", this.groupId, this.sceneId, this.dbGameFree.GetName()+this.dbGameFree.GetTitle(), this.robotNum, num, this.robotLimit) //logger.Logger.Tracef("(this *Scene)(groupid:%v sceneid:%v) TryInviteRobot(%v) current robot(%v+%v) robotlimit(%v)", this.groupId, this.sceneId, this.GetDBGameFree().GetName()+this.GetDBGameFree().GetTitle(), this.robotNum, num, this.robotLimit)
//同步下房间里的参数' //同步下房间里的参数'
NpcServerAgentSingleton.SyncDBGameFree(this.SceneId, this.GetDBGameFree()) NpcServerAgentSingleton.SyncDBGameFree(int(this.SceneId), this.GetDBGameFree())
//然后再邀请 //然后再邀请
NpcServerAgentSingleton.Invite(this.SceneId, int(num), this.DbGameFree.Id) NpcServerAgentSingleton.Invite(int(this.SceneId), int(num), this.GetDBGameFree().Id)
} }
} }
} }
@ -1883,10 +1800,10 @@ func (this *Scene) IsAllRealInGame() bool {
// 是否开启机器人对战游戏 // 是否开启机器人对战游戏
func (this *Scene) IsRobFightGame() bool { func (this *Scene) IsRobFightGame() bool {
if this.DbGameFree == nil { if this.GetDBGameFree() == nil {
return false return false
} }
if this.DbGameFree.GetAi()[0] == 1 && model.GameParamData.IsRobFightTest == true { if this.GetDBGameFree().GetAi()[0] == 1 && model.GameParamData.IsRobFightTest == true {
return true return true
} }
return false return false
@ -1915,7 +1832,7 @@ func (this *Scene) RobotLeaveHundred() {
//钱多 //钱多
leave = true leave = true
reason = common.PlayerLeaveReason_Normal reason = common.PlayerLeaveReason_Normal
} else if p.Coin < int64(this.DbGameFree.GetBetLimit()) { } else if p.Coin < int64(this.GetDBGameFree().GetBetLimit()) {
//少于下注限额 //少于下注限额
leave = true leave = true
reason = common.PlayerLeaveReason_Normal reason = common.PlayerLeaveReason_Normal
@ -1975,7 +1892,7 @@ func (this *Scene) GetRecordId() string {
func (this *Scene) RandTakeCoin(p *Player) (takeCoin, leaveCoin, gameTimes int64) { func (this *Scene) RandTakeCoin(p *Player) (takeCoin, leaveCoin, gameTimes int64) {
if p.IsRob && p.IsLocal { if p.IsRob && p.IsLocal {
dbGameFree := this.DbGameFree dbGameFree := this.GetDBGameFree()
takerng := dbGameFree.GetRobotTakeCoin() takerng := dbGameFree.GetRobotTakeCoin()
if len(takerng) >= 2 && takerng[1] > takerng[0] { if len(takerng) >= 2 && takerng[1] > takerng[0] {
if takerng[0] < dbGameFree.GetLimitCoin() { if takerng[0] < dbGameFree.GetLimitCoin() {
@ -2014,8 +1931,8 @@ func (this *Scene) TryBillExGameDrop(p *Player) {
this.DropCollectBox(p) this.DropCollectBox(p)
baseScore := this.DbGameFree.BaseScore baseScore := this.GetDBGameFree().BaseScore
if common.IsLocalGame(this.GameId) { if common.IsLocalGame(int(this.GameId)) {
baseScore = this.BaseScore baseScore = this.BaseScore
} }
if baseScore == 0 { if baseScore == 0 {
@ -2023,7 +1940,7 @@ func (this *Scene) TryBillExGameDrop(p *Player) {
} }
// 场次掉落开关 // 场次掉落开关
if this.DbGameFree.IsDrop != 1 { if this.GetDBGameFree().IsDrop != 1 {
return return
} }
@ -2288,7 +2205,7 @@ func (this *Scene) Statistics(param *StaticParam) {
return return
} }
_, isNovice := p.NoviceOdds(this.GameId) _, isNovice := p.NoviceOdds(int(this.GameId))
isControl := this.IsControl(param.HasRobotGaming) // 需要调控的房间 isControl := this.IsControl(param.HasRobotGaming) // 需要调控的房间
var wbLevel = p.WBLevel // 原来的黑白名单等级; 注意SyncPlayerDatas会修改WBLevel var wbLevel = p.WBLevel // 原来的黑白名单等级; 注意SyncPlayerDatas会修改WBLevel
@ -2373,8 +2290,8 @@ func (this *Scene) Statistics(param *StaticParam) {
} }
// 新手输赢统计 // 新手输赢统计
if !model.GameParamData.CloseNovice && !common.InSliceInt(model.GameParamData.CloseNoviceGame, this.GameId) && isControl && wbLevel == 0 && isNovice { if !model.GameParamData.CloseNovice && !common.InSliceInt(model.GameParamData.CloseNoviceGame, int(this.GameId)) && isControl && wbLevel == 0 && isNovice {
keyNoviceGameId := common.GetKeyNoviceGameId(this.GameId) keyNoviceGameId := common.GetKeyNoviceGameId(int(this.GameId))
var gs *model.PlayerGameStatics var gs *model.PlayerGameStatics
if data, ok := p.GDatas[keyNoviceGameId]; ok { if data, ok := p.GDatas[keyNoviceGameId]; ok {
statics = append(statics, &data.Statics) statics = append(statics, &data.Statics)
@ -2474,7 +2391,7 @@ func (this *Scene) Statistics(param *StaticParam) {
} }
p.WinCoin += totalOut p.WinCoin += totalOut
p.TaxCoin += param.GainTax p.TaxCoin += param.GainTax
if isPlayerPool && srvdata.GameFreeMgr.IsPlayerPool(this.GameId) { if isPlayerPool && srvdata.GameFreeMgr.IsPlayerPool(int(this.GameId)) {
p.TotalOut += totalOut p.TotalOut += totalOut
p.PlayerTax += param.GainTax p.PlayerTax += param.GainTax
} }
@ -2483,7 +2400,7 @@ func (this *Scene) Statistics(param *StaticParam) {
p.FailTimes++ p.FailTimes++
} }
p.FailCoin += totalIn p.FailCoin += totalIn
if isPlayerPool && srvdata.GameFreeMgr.IsPlayerPool(this.GameId) { if isPlayerPool && srvdata.GameFreeMgr.IsPlayerPool(int(this.GameId)) {
p.TotalIn += totalIn p.TotalIn += totalIn
} }
} else { } else {

View File

@ -32,38 +32,47 @@ func (this *SceneMgr) makeKey(gameid, gamemode int) int {
return int(gameid*10000 + gamemode) return int(gameid*10000 + gamemode)
} }
func (this *SceneMgr) CreateScene(s *netlib.Session, sceneId, gameMode, sceneMode, gameId int, platform string, type CreateSceneParam struct {
params []int64, agentor, creator int32, replayCode string, hallId, groupId, totalOfGames int32, Session *netlib.Session
dbGameFree *server.DB_GameFree, bEnterAfterStart bool, baseScore int32, playerNum int, chessRank []int32) *Scene { *server.WGCreateScene
scene := NewScene(s, sceneId, gameMode, sceneMode, gameId, platform, params, agentor, creator, replayCode, }
hallId, groupId, totalOfGames, dbGameFree, bEnterAfterStart, baseScore, playerNum, chessRank)
func (this *SceneMgr) CreateScene(args *CreateSceneParam) *Scene {
scene := NewScene(args)
if scene == nil { if scene == nil {
logger.Logger.Error("(this *SceneMgr) CreateScene, scene == nil") logger.Logger.Error("(this *SceneMgr) CreateScene, scene == nil")
return nil return nil
} }
this.scenes[scene.SceneId] = scene
platform := args.GetPlatform()
gameId := args.GetGameId()
gameMode := args.GetGameMode()
gameFreeId := args.GetDBGameFree().GetId()
// 平台标记
this.scenes[int(scene.SceneId)] = scene
if _, ok := this.PlatformScene[platform]; !ok { if _, ok := this.PlatformScene[platform]; !ok {
this.PlatformScene[platform] = true this.PlatformScene[platform] = true
} }
// // 游戏id索引
key := this.makeKey(gameId, gameMode) key := this.makeKey(int(gameId), int(gameMode))
if ss, exist := this.scenesByGame[key]; exist { if ss, exist := this.scenesByGame[key]; exist {
ss[scene.SceneId] = scene ss[int(scene.SceneId)] = scene
} else { } else {
ss = make(map[int]*Scene) ss = make(map[int]*Scene)
ss[scene.SceneId] = scene ss[int(scene.SceneId)] = scene
this.scenesByGame[key] = ss this.scenesByGame[key] = ss
} }
// // 场次id索引
if ss, exist := this.scenesByGameFree[dbGameFree.GetId()]; exist { if ss, exist := this.scenesByGameFree[gameFreeId]; exist {
ss[scene.SceneId] = scene ss[int(scene.SceneId)] = scene
} else { } else {
ss = make(map[int]*Scene) ss = make(map[int]*Scene)
ss[scene.SceneId] = scene ss[int(scene.SceneId)] = scene
this.scenesByGameFree[dbGameFree.GetId()] = ss this.scenesByGameFree[gameFreeId] = ss
} }
scene.OnStart() scene.OnStart()
logger.Logger.Infof("(this *SceneMgr) CreateScene,New scene,id:[%d] replaycode:[%v]", scene.SceneId, replayCode) logger.Logger.Infof("(this *SceneMgr) CreateScene,New scene,id:[%d] replaycode:[%v]", scene.SceneId, args.GetReplayCode())
return scene return scene
} }
@ -71,13 +80,13 @@ func (this *SceneMgr) DestroyScene(sceneId int) {
if scene, exist := this.scenes[sceneId]; exist { if scene, exist := this.scenes[sceneId]; exist {
scene.OnStop() scene.OnStop()
// //
key := this.makeKey(scene.GameId, scene.GameMode) key := this.makeKey(int(scene.GameId), int(scene.GameMode))
if ss, exist := this.scenesByGame[key]; exist { if ss, exist := this.scenesByGame[key]; exist {
delete(ss, scene.SceneId) delete(ss, int(scene.SceneId))
} }
// //
if ss, exist := this.scenesByGameFree[scene.GetGameFreeId()]; exist { if ss, exist := this.scenesByGameFree[scene.GetGameFreeId()]; exist {
delete(ss, scene.SceneId) delete(ss, int(scene.SceneId))
} }
delete(this.scenes, sceneId) delete(this.scenes, sceneId)
logger.Logger.Infof("(this *SceneMgr) DestroyScene, sceneid = %v", sceneId) logger.Logger.Infof("(this *SceneMgr) DestroyScene, sceneid = %v", sceneId)
@ -169,7 +178,7 @@ func (this *SceneMgr) JackPotSync(platform string, gameIds ...int32) {
val := s.sp.GetJackPotVal(s) val := s.sp.GetJackPotVal(s)
if val > 0 { if val > 0 {
jpfi := &gamehall.GameJackpotFundInfo{ jpfi := &gamehall.GameJackpotFundInfo{
GameFreeId: proto.Int32(s.DbGameFree.Id), GameFreeId: proto.Int32(s.GetGameFreeId()),
JackPotFund: proto.Int64(val), JackPotFund: proto.Int64(val),
} }
pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi) pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi)

View File

@ -59,14 +59,14 @@ func (this *CaiShenSceneData) SceneDestroy(force bool) {
} }
func (this *CaiShenSceneData) init() bool { func (this *CaiShenSceneData) init() bool {
if this.DbGameFree == nil { if this.GetDBGameFree() == nil {
return false return false
} }
params := this.DbGameFree.GetJackpot() params := this.GetDBGameFree().GetJackpot()
this.jackpot = &base.SlotJackpotPool{} this.jackpot = &base.SlotJackpotPool{}
if this.jackpot.Small <= 0 { if this.jackpot.Small <= 0 {
this.jackpot.Small = 0 this.jackpot.Small = 0
this.jackpot.VirtualJK = int64(params[rule.CAISHEN_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) this.jackpot.VirtualJK = int64(params[rule.CAISHEN_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore())
} }
str := base.XSlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform) str := base.XSlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform)
if str != "" { if str != "" {
@ -102,7 +102,7 @@ type CaiShenSpinResult struct {
} }
func (this *CaiShenSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes CaiShenSpinResult) { func (this *CaiShenSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes CaiShenSpinResult) {
taxRate := this.DbGameFree.GetTaxRate() taxRate := this.GetDBGameFree().GetTaxRate()
calcTaxScore := func(score int64, taxScore *int64) int64 { calcTaxScore := func(score int64, taxScore *int64) int64 {
newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0) newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0)
if taxScore != nil { if taxScore != nil {
@ -188,7 +188,7 @@ func (this *CaiShenSceneData) BroadcastJackpot(sync bool) {
this.lastJackpotValue = this.jackpot.VirtualJK this.lastJackpotValue = this.jackpot.VirtualJK
pack := &gamehall.SCHundredSceneGetGameJackpot{} pack := &gamehall.SCHundredSceneGetGameJackpot{}
jpfi := &gamehall.GameJackpotFundInfo{ jpfi := &gamehall.GameJackpotFundInfo{
GameFreeId: proto.Int32(this.DbGameFree.Id), GameFreeId: proto.Int32(this.GetDBGameFree().Id),
JackPotFund: proto.Int64(this.jackpot.VirtualJK), JackPotFund: proto.Int64(this.jackpot.VirtualJK),
} }
pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi) pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi)
@ -215,7 +215,7 @@ func (this *CaiShenSceneData) PopCoinPool(winCoin int64, IsNovice bool) {
} }
} }
func (this *CaiShenSceneData) RecordBurstLog(name string, wincoin, totalbet int64) { func (this *CaiShenSceneData) RecordBurstLog(name string, wincoin, totalbet int64) {
log := model.NewBurstJackpotLog(this.Platform, this.DbGameFree.GameId, this.GetGameFreeId(), name, wincoin, totalbet) log := model.NewBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId, this.GetGameFreeId(), name, wincoin, totalbet)
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.InsertBurstJackpotLogs(log) return model.InsertBurstJackpotLogs(log)
}), nil, "InsertBurstJackpotLogs").Start() }), nil, "InsertBurstJackpotLogs").Start()
@ -223,7 +223,7 @@ func (this *CaiShenSceneData) RecordBurstLog(name string, wincoin, totalbet int6
func (this *CaiShenSceneData) BurstHistory(player *CaiShenPlayerData) { func (this *CaiShenSceneData) BurstHistory(player *CaiShenPlayerData) {
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.GetBurstJackpotLog(this.Platform, this.DbGameFree.GameId) return model.GetBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId)
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
var logsp []*caishen.CaiShenBurstHistoryInfo var logsp []*caishen.CaiShenBurstHistoryInfo
if data != nil { if data != nil {
@ -251,7 +251,7 @@ func (this *CaiShenSceneData) GetLastBurstJackPot() time.Time {
} }
func (this *CaiShenSceneData) SetLastBurstJackPot() { func (this *CaiShenSceneData) SetLastBurstJackPot() {
var randT = rand.Intn(25200-7200+1) + 7200 var randT = rand.Intn(25200-7200+1) + 7200
switch this.DbGameFree.SceneType { switch this.GetDBGameFree().SceneType {
case 1: case 1:
randT = rand.Intn(25200-7200+1) + 7200 randT = rand.Intn(25200-7200+1) + 7200
case 2: case 2:
@ -267,7 +267,7 @@ func (this *CaiShenSceneData) SetLastBurstJackPot() {
func (this *CaiShenSceneData) AIAddJackPot() { func (this *CaiShenSceneData) AIAddJackPot() {
if time.Now().Sub(this.lastJackPot) > 0 { if time.Now().Sub(this.lastJackPot) > 0 {
var randT = rand.Intn(3) + 1 var randT = rand.Intn(3) + 1
switch this.DbGameFree.SceneType { switch this.GetDBGameFree().SceneType {
case 1: case 1:
randT = rand.Intn(3) + 1 randT = rand.Intn(3) + 1
case 2: case 2:
@ -280,20 +280,20 @@ func (this *CaiShenSceneData) AIAddJackPot() {
randT = rand.Intn(3) + 1 randT = rand.Intn(3) + 1
} }
this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT)) this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT))
val := int64(math.Floor(float64(this.DbGameFree.GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000)) val := int64(math.Floor(float64(this.GetDBGameFree().GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
this.jackpot.VirtualJK += val this.jackpot.VirtualJK += val
} }
} }
func (this *CaiShenSceneData) AIBurstJackPot() { func (this *CaiShenSceneData) AIBurstJackPot() {
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 { if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
this.SetLastBurstJackPot() this.SetLastBurstJackPot()
jackpotParams := this.DbGameFree.GetJackpot() jackpotParams := this.GetDBGameFree().GetJackpot()
var jackpotInit = int64(jackpotParams[rule.CAISHEN_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) //奖池初始值 var jackpotInit = int64(jackpotParams[rule.CAISHEN_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) //奖池初始值
//AI机器人爆奖 //AI机器人爆奖
val := this.jackpot.VirtualJK val := this.jackpot.VirtualJK
this.jackpot.VirtualJK = jackpotInit this.jackpot.VirtualJK = jackpotInit
bet := int64(this.DbGameFree.GetBaseScore()) * int64(rule.LINENUM) bet := int64(this.GetDBGameFree().GetBaseScore()) * int64(rule.LINENUM)
this.RecordBurstLog(this.RandNickName(), val, int64(bet)) this.RecordBurstLog(this.RandNickName(), val, int64(bet))
} }
} }
@ -314,11 +314,11 @@ func (this *CaiShenSceneData) KickPlayerByTime() {
} }
//for _, p := range this.players { //for _, p := range this.players {
// //游戏次数达到目标值 // //游戏次数达到目标值
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId())) // todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.GetDBGameFree().GetId()))
// if !p.IsRob && // if !p.IsRob &&
// todayGamefreeIDSceneData != nil && // todayGamefreeIDSceneData != nil &&
// this.DbGameFree.GetPlayNumLimit() != 0 && // this.GetDBGameFree().GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) { // todayGamefreeIDSceneData.GameTimes >= int64(this.GetDBGameFree().GetPlayNumLimit()) {
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true) // this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
// } // }
//} //}

View File

@ -94,8 +94,8 @@ func (this *ScenePolicyCaiShen) OnPlayerEnter(s *base.Scene, p *base.Player) {
logger.Logger.Trace("(this *ScenePolicyCaiShen) OnPlayerEnter, SceneId=", s.SceneId, " player=", p.SnId) logger.Logger.Trace("(this *ScenePolicyCaiShen) OnPlayerEnter, SceneId=", s.SceneId, " player=", p.SnId)
if sceneEx, ok := s.ExtraData.(*CaiShenSceneData); ok { if sceneEx, ok := s.ExtraData.(*CaiShenSceneData); ok {
playerEx := &CaiShenPlayerData{Player: p} playerEx := &CaiShenPlayerData{Player: p}
playerEx.init(s) // 玩家当前信息初始化 playerEx.init(s) // 玩家当前信息初始化
playerEx.score = sceneEx.DbGameFree.GetBaseScore() // 底注 playerEx.score = sceneEx.GetDBGameFree().GetBaseScore() // 底注
sceneEx.players[p.SnId] = playerEx sceneEx.players[p.SnId] = playerEx
p.ExtraData = playerEx p.ExtraData = playerEx
CaiShenSendRoomInfo(s, p, sceneEx, playerEx, nil) CaiShenSendRoomInfo(s, p, sceneEx, playerEx, nil)
@ -230,14 +230,14 @@ func (this *ScenePolicyCaiShen) GetJackPotVal(s *base.Scene) int64 {
func CaiShenSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *CaiShenSceneData, playerEx *CaiShenPlayerData, data *caishen.GameBilledData) { func CaiShenSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *CaiShenSceneData, playerEx *CaiShenPlayerData, data *caishen.GameBilledData) {
logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId) logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId)
pack := &caishen.SCCaiShenRoomInfo{ pack := &caishen.SCCaiShenRoomInfo{
RoomId: proto.Int(s.SceneId), RoomId: s.SceneId,
Creator: proto.Int32(s.Creator), Creator: proto.Int32(s.Creator),
GameId: proto.Int(s.GameId), GameId: s.GameId,
RoomMode: proto.Int(s.GameMode), RoomMode: s.GameMode,
Params: common.CopySliceInt64ToInt32(s.Params), Params: common.CopySliceInt64ToInt32(s.Params),
State: proto.Int(s.SceneState.GetState()), State: proto.Int(s.SceneState.GetState()),
Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK), Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK),
GameFreeId: proto.Int32(s.DbGameFree.Id), GameFreeId: proto.Int32(s.GetDBGameFree().Id),
BilledData: data, BilledData: data,
} }
@ -257,7 +257,7 @@ func CaiShenSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *CaiShenSceneDat
//} //}
pack.BetLines = playerEx.betLines pack.BetLines = playerEx.betLines
pack.FreeTimes = proto.Int32(playerEx.freeTimes) pack.FreeTimes = proto.Int32(playerEx.freeTimes)
pack.Chip = proto.Int32(s.DbGameFree.BaseScore) pack.Chip = proto.Int32(s.GetDBGameFree().BaseScore)
pack.SpinID = proto.Int64(playerEx.spinID) pack.SpinID = proto.Int64(playerEx.spinID)
if playerEx.totalPriceBonus > 0 { if playerEx.totalPriceBonus > 0 {
switch playerEx.bonusStage { switch playerEx.bonusStage {
@ -373,7 +373,7 @@ func (this *SceneStateCaiShenStart) OnPlayerOp(s *base.Scene, p *base.Player, op
return false return false
} }
//先做底注校验 //先做底注校验
if sceneEx.DbGameFree.GetBaseScore() != int32(params[0]) { if sceneEx.GetDBGameFree().GetBaseScore() != int32(params[0]) {
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, caishen.OpResultCode_OPRC_Error, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, caishen.OpResultCode_OPRC_Error, params)
return false return false
} }
@ -407,7 +407,7 @@ func (this *SceneStateCaiShenStart) OnPlayerOp(s *base.Scene, p *base.Player, op
if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin { if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin {
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, caishen.OpResultCode_OPRC_CoinNotEnough, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, caishen.OpResultCode_OPRC_CoinNotEnough, params)
return false return false
} else if playerEx.freeTimes <= 0 && int64(sceneEx.DbGameFree.GetBetLimit()) > playerEx.Coin { //押注限制 } else if playerEx.freeTimes <= 0 && int64(sceneEx.GetDBGameFree().GetBetLimit()) > playerEx.Coin { //押注限制
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, caishen.OpResultCode_OPRC_CoinNotEnough, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, caishen.OpResultCode_OPRC_CoinNotEnough, params)
return false return false
} }
@ -422,7 +422,7 @@ func (this *SceneStateCaiShenStart) OnPlayerOp(s *base.Scene, p *base.Player, op
sceneEx.CpCtx = base.CoinPoolMgr.GetCoinPoolCtx(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId) sceneEx.CpCtx = base.CoinPoolMgr.GetCoinPoolCtx(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId)
//税收比例 //税收比例
taxRate := sceneEx.DbGameFree.GetTaxRate() taxRate := sceneEx.GetDBGameFree().GetTaxRate()
if taxRate < 0 || taxRate > 10000 { if taxRate < 0 || taxRate > 10000 {
logger.Logger.Tracef("CaiShenErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate) logger.Logger.Tracef("CaiShenErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate)
taxRate = 500 taxRate = 500
@ -445,8 +445,8 @@ func (this *SceneStateCaiShenStart) OnPlayerOp(s *base.Scene, p *base.Player, op
prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额 prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额
// 奖池参数 // 奖池参数
var jackpotParam = sceneEx.DbGameFree.GetJackpot() var jackpotParam = sceneEx.GetDBGameFree().GetJackpot()
var jackpotInit = int64(jackpotParam[rule.CAISHEN_JACKPOT_InitJackpot]) * int64(sceneEx.DbGameFree.GetBaseScore()) //奖池初始值 var jackpotInit = int64(jackpotParam[rule.CAISHEN_JACKPOT_InitJackpot]) * int64(sceneEx.GetDBGameFree().GetBaseScore()) //奖池初始值
var jackpotFundAdd, prizeFundAdd int64 var jackpotFundAdd, prizeFundAdd int64
if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注 if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注
@ -466,7 +466,7 @@ func (this *SceneStateCaiShenStart) OnPlayerOp(s *base.Scene, p *base.Player, op
////统计参与游戏次数 ////统计参与游戏次数
//if !sceneEx.Testing && !playerEx.IsRob { //if !sceneEx.Testing && !playerEx.IsRob {
// pack := &server.GWSceneEnd{ // pack := &server.GWSceneEnd{
// GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()), // GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
// Players: []*server.PlayerCtx{&server.PlayerCtx{SnId: proto.Int32(playerEx.SnId), Coin: proto.Int64(playerEx.Coin)}}, // Players: []*server.PlayerCtx{&server.PlayerCtx{SnId: proto.Int32(playerEx.SnId), Coin: proto.Int64(playerEx.Coin)}},
// } // }
// proto.SetDefaults(pack) // proto.SetDefaults(pack)
@ -656,7 +656,7 @@ func (this *SceneStateCaiShenStart) OnPlayerOp(s *base.Scene, p *base.Player, op
case CaiShenPlayerHistory: case CaiShenPlayerHistory:
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
spinid := strconv.FormatInt(int64(playerEx.SnId), 10) spinid := strconv.FormatInt(int64(playerEx.SnId), 10)
gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.DbGameFree.GetGameClass(), s.GameId) gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.GetDBGameFree().GetGameClass(), int(s.GameId))
pack := &caishen.SCCaiShenPlayerHistory{} pack := &caishen.SCCaiShenPlayerHistory{}
for _, v := range gpl.Data { for _, v := range gpl.Data {
//if v.GameDetailedLogId == "" { //if v.GameDetailedLogId == "" {
@ -847,7 +847,7 @@ func (this *SceneStateCaiShenStart) WinTargetBenchTest(s *base.Scene, p *base.Pl
} }
file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,中线倍数,中线数,剩余免费次数\r\n") file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,中线倍数,中线数,剩余免费次数\r\n")
oldCoin := p.Coin oldCoin := p.Coin
switch s.DbGameFree.GetSceneType() { switch s.GetDBGameFree().GetSceneType() {
case 1: case 1:
p.Coin = 100000 p.Coin = 100000
case 2: case 2:
@ -905,7 +905,7 @@ func (this *SceneStateCaiShenStart) MultiplayerBenchTest(s *base.Scene) {
}) })
caiShenBenchTestTimes++ caiShenBenchTestTimes++
fileName := fmt.Sprintf("caishen-total-%v-%d.csv", s.DbGameFree.GetSceneType(), caiShenBenchTestTimes) fileName := fmt.Sprintf("caishen-total-%v-%d.csv", s.GetDBGameFree().GetSceneType(), caiShenBenchTestTimes)
file, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE|os.O_APPEND, os.ModePerm) file, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE|os.O_APPEND, os.ModePerm)
defer file.Close() defer file.Close()
if err != nil { if err != nil {
@ -918,7 +918,7 @@ func (this *SceneStateCaiShenStart) MultiplayerBenchTest(s *base.Scene) {
playersFile := make(map[int32]*os.File) playersFile := make(map[int32]*os.File)
oldCoins := make(map[int32]int64) oldCoins := make(map[int32]int64)
hasCoin := 1000 * int64(s.DbGameFree.GetBaseScore()) hasCoin := 1000 * int64(s.GetDBGameFree().GetBaseScore())
robots := make(map[int32]bool) robots := make(map[int32]bool)
testPlayers := make(map[int32]*base.Player) testPlayers := make(map[int32]*base.Player)
for _, p := range s.Players { for _, p := range s.Players {
@ -926,7 +926,7 @@ func (this *SceneStateCaiShenStart) MultiplayerBenchTest(s *base.Scene) {
p.IsRob = false p.IsRob = false
robots[p.SnId] = true robots[p.SnId] = true
} }
fileName := fmt.Sprintf("caishen-player%v-%v-%d.csv", p.SnId, s.DbGameFree.GetSceneType(), caiShenBenchTestTimes) fileName := fmt.Sprintf("caishen-player%v-%v-%d.csv", p.SnId, s.GetDBGameFree().GetSceneType(), caiShenBenchTestTimes)
file, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE|os.O_APPEND, os.ModePerm) file, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE|os.O_APPEND, os.ModePerm)
if err != nil { if err != nil {
file, err = os.Create(fileName) file, err = os.Create(fileName)
@ -955,7 +955,7 @@ func (this *SceneStateCaiShenStart) MultiplayerBenchTest(s *base.Scene) {
} }
}() }()
totalBet := int64(s.DbGameFree.GetBaseScore()) * int64(len(rule.AllBetLines)) totalBet := int64(s.GetDBGameFree().GetBaseScore()) * int64(len(rule.AllBetLines))
for i := 0; i < BENCH_CNT; i++ { for i := 0; i < BENCH_CNT; i++ {
for snid, p := range testPlayers { for snid, p := range testPlayers {
if playerEx, ok := p.ExtraData.(*CaiShenPlayerData); ok { if playerEx, ok := p.ExtraData.(*CaiShenPlayerData); ok {
@ -970,7 +970,7 @@ func (this *SceneStateCaiShenStart) MultiplayerBenchTest(s *base.Scene) {
inCoin := int64(playerEx.RollGameType.BaseResult.TotalBet) inCoin := int64(playerEx.RollGameType.BaseResult.TotalBet)
outCoin := playerEx.RollGameType.BaseResult.ChangeCoin + inCoin outCoin := playerEx.RollGameType.BaseResult.ChangeCoin + inCoin
taxCoin := playerEx.RollGameType.BaseResult.Tax taxCoin := playerEx.RollGameType.BaseResult.Tax
lineScore := float64(playerEx.RollGameType.BaseResult.WinRate*s.DbGameFree.GetBaseScore()) * float64(10000.0-s.DbGameFree.GetTaxRate()) / 10000.0 lineScore := float64(playerEx.RollGameType.BaseResult.WinRate*s.GetDBGameFree().GetBaseScore()) * float64(10000.0-s.GetDBGameFree().GetTaxRate()) / 10000.0
jackpotScore := outCoin - playerEx.RollGameType.BaseResult.WinSmallGame - int64(lineScore+0.00001) jackpotScore := outCoin - playerEx.RollGameType.BaseResult.WinSmallGame - int64(lineScore+0.00001)
str := fmt.Sprintf("%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v\r\n", p.SnId, poolCoin, StartCoin, p.Coin, inCoin, outCoin, taxCoin, str := fmt.Sprintf("%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v\r\n", p.SnId, poolCoin, StartCoin, p.Coin, inCoin, outCoin, taxCoin,
@ -1004,7 +1004,7 @@ func CaiShenCheckAndSaveLog(sceneEx *CaiShenSceneData, playerEx *CaiShenPlayerDa
//log2 //log2
playerEx.RollGameType.BaseResult.ChangeCoin = changeCoin playerEx.RollGameType.BaseResult.ChangeCoin = changeCoin
playerEx.RollGameType.BaseResult.BasicBet = sceneEx.DbGameFree.GetBaseScore() playerEx.RollGameType.BaseResult.BasicBet = sceneEx.GetDBGameFree().GetBaseScore()
playerEx.RollGameType.BaseResult.RoomId = int32(sceneEx.SceneId) playerEx.RollGameType.BaseResult.RoomId = int32(sceneEx.SceneId)
playerEx.RollGameType.BaseResult.AfterCoin = playerEx.Coin playerEx.RollGameType.BaseResult.AfterCoin = playerEx.Coin
playerEx.RollGameType.BaseResult.BeforeCoin = startCoin playerEx.RollGameType.BaseResult.BeforeCoin = startCoin
@ -1063,8 +1063,8 @@ func CaiShenCheckAndSaveLog(sceneEx *CaiShenSceneData, playerEx *CaiShenPlayerDa
GameCoinTs: proto.Int64(playerEx.GameCoinTs), GameCoinTs: proto.Int64(playerEx.GameCoinTs),
} }
gwPlayerBet := &server.GWPlayerData{ gwPlayerBet := &server.GWPlayerData{
SceneId: proto.Int(sceneEx.SceneId), SceneId: sceneEx.SceneId,
GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()), GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
} }
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet) gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
sceneEx.SyncPlayerDatas(&base.PlayerDataParam{ sceneEx.SyncPlayerDatas(&base.PlayerDataParam{

View File

@ -53,7 +53,7 @@ func getChessVariant(gameId int) int {
} }
func NewSceneEx(s *base.Scene) *SceneEx { func NewSceneEx(s *base.Scene) *SceneEx {
variant := getChessVariant(s.GameId) variant := getChessVariant(int(s.GameId))
chess := rule.NewChess(variant) chess := rule.NewChess(variant)
chess.Init() chess.Init()
sceneEx := &SceneEx{ sceneEx := &SceneEx{

View File

@ -485,7 +485,7 @@ func CreateRoomInfoPacket(s *base.Scene, p *base.Player, sceneEx *SceneEx, playe
State: proto.Int32(int32(s.GetSceneState().GetState())), State: proto.Int32(int32(s.GetSceneState().GetState())),
TimeOut: proto.Int(s.GetSceneState().GetTimeout(s)), TimeOut: proto.Int(s.GetSceneState().GetTimeout(s)),
NumOfGames: proto.Int(sceneEx.NumOfGames), NumOfGames: proto.Int(sceneEx.NumOfGames),
TotalOfGames: proto.Int(sceneEx.TotalOfGames), TotalOfGames: sceneEx.TotalOfGames,
CurOpIdx: proto.Int(-1), CurOpIdx: proto.Int(-1),
MasterSnid: proto.Int32(sceneEx.masterSnId), MasterSnid: proto.Int32(sceneEx.masterSnId),
AudienceNum: proto.Int(s.GetAudiencesNum()), AudienceNum: proto.Int(s.GetAudiencesNum()),
@ -528,7 +528,7 @@ func CreateRoomInfoPacket(s *base.Scene, p *base.Player, sceneEx *SceneEx, playe
} }
pack.MatchFinals = 0 pack.MatchFinals = 0
if s.MatchFinals { if s.GetMatch().GetIsFinals() {
pack.MatchFinals = 1 pack.MatchFinals = 1
if s.NumOfGames >= 2 { if s.NumOfGames >= 2 {
pack.MatchFinals = 2 pack.MatchFinals = 2
@ -852,7 +852,7 @@ func (this *SceneStateWaitStart) OnTick(s *base.Scene) {
if sceneEx, ok := s.GetExtraData().(*SceneEx); ok { if sceneEx, ok := s.GetExtraData().(*SceneEx); ok {
if sceneEx.IsMatchScene() { if sceneEx.IsMatchScene() {
delayT := time.Second * 2 delayT := time.Second * 2
if sceneEx.MatchRound != 1 { //第一轮延迟2s其他延迟3s 配合客户端播放动画 if sceneEx.GetMatch().GetCurrRound() != 1 { //第一轮延迟2s其他延迟3s 配合客户端播放动画
delayT = time.Second * 4 delayT = time.Second * 4
} }
if time.Now().Sub(sceneEx.StateStartTime) > delayT { if time.Now().Sub(sceneEx.StateStartTime) > delayT {
@ -1215,14 +1215,14 @@ func (this *SceneStateBilled) OnEnter(s *base.Scene) {
pack := &chesstitians.SCChesstitiansGameBilled{} pack := &chesstitians.SCChesstitiansGameBilled{}
chessType := model.ChesstitiansType{ chessType := model.ChesstitiansType{
GameId: sceneEx.GameId, GameId: int(sceneEx.GameId),
RoomId: int32(sceneEx.GetSceneId()), RoomId: int32(sceneEx.GetSceneId()),
RoomType: int32(sceneEx.Scene.SceneType), RoomType: sceneEx.Scene.GetDBGameFree().GetSceneType(),
NumOfGames: int32(sceneEx.Scene.NumOfGames), NumOfGames: int32(sceneEx.Scene.NumOfGames),
BankId: sceneEx.masterSnId, BankId: sceneEx.masterSnId,
PlayerCount: rule.MaxNumOfPlayer, PlayerCount: rule.MaxNumOfPlayer,
BaseScore: s.BaseScore, BaseScore: s.BaseScore,
TaxRate: s.DbGameFree.GetTaxRate(), TaxRate: s.GetDBGameFree().GetTaxRate(),
RoomMode: s.GetSceneMode(), RoomMode: s.GetSceneMode(),
} }
@ -1462,7 +1462,7 @@ func (this *SceneStateBilled) OnLeave(s *base.Scene) {
return return
} }
if s.CheckNeedDestroy() || (s.IsMatchScene() && (!s.MatchFinals || (s.MatchFinals && s.NumOfGames >= 2))) { // 非决赛打一场 决赛打两场 if s.CheckNeedDestroy() || (s.IsMatchScene() && (!s.GetMatch().GetIsFinals() || (s.GetMatch().GetIsFinals() && s.NumOfGames >= 2))) { // 非决赛打一场 决赛打两场
sceneEx.SceneDestroy(true) sceneEx.SceneDestroy(true)
} }
s.TryRelease() s.TryRelease()

View File

@ -53,14 +53,14 @@ func (this *EasterIslandSceneData) OnPlayerLeave(p *base.Player, reason int) {
} }
func (this *EasterIslandSceneData) init() bool { func (this *EasterIslandSceneData) init() bool {
if this.DbGameFree == nil { if this.GetDBGameFree() == nil {
return false return false
} }
params := this.DbGameFree.GetJackpot() params := this.GetDBGameFree().GetJackpot()
this.jackpot = &base.SlotJackpotPool{} this.jackpot = &base.SlotJackpotPool{}
if this.jackpot.Small <= 0 { if this.jackpot.Small <= 0 {
this.jackpot.Small = 0 this.jackpot.Small = 0
this.jackpot.VirtualJK = int64(params[rule.EL_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) this.jackpot.VirtualJK = int64(params[rule.EL_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore())
} }
str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform) str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform)
if str != "" { if str != "" {
@ -101,7 +101,7 @@ type EasterIslandSpinResult struct {
} }
func (this *EasterIslandSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes EasterIslandSpinResult) { func (this *EasterIslandSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes EasterIslandSpinResult) {
taxRate := this.DbGameFree.GetTaxRate() taxRate := this.GetDBGameFree().GetTaxRate()
calcTaxScore := func(score int64, taxScore *int64) int64 { calcTaxScore := func(score int64, taxScore *int64) int64 {
newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0) newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0)
if taxScore != nil { if taxScore != nil {
@ -192,7 +192,7 @@ func (this *EasterIslandSceneData) BroadcastJackpot(sync bool) {
this.lastJackpotValue = this.jackpot.VirtualJK this.lastJackpotValue = this.jackpot.VirtualJK
pack := &gamehall.SCHundredSceneGetGameJackpot{} pack := &gamehall.SCHundredSceneGetGameJackpot{}
jpfi := &gamehall.GameJackpotFundInfo{ jpfi := &gamehall.GameJackpotFundInfo{
GameFreeId: proto.Int32(this.DbGameFree.Id), GameFreeId: proto.Int32(this.GetDBGameFree().Id),
JackPotFund: proto.Int64(this.jackpot.VirtualJK), JackPotFund: proto.Int64(this.jackpot.VirtualJK),
} }
pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi) pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi)
@ -218,7 +218,7 @@ func (this *EasterIslandSceneData) PopCoinPool(winCoin int64, IsNovice bool) {
} }
} }
func (this *EasterIslandSceneData) RecordBurstLog(name string, wincoin, totalbet int64) { func (this *EasterIslandSceneData) RecordBurstLog(name string, wincoin, totalbet int64) {
log := model.NewBurstJackpotLog(this.Platform, this.DbGameFree.GameId, this.GetGameFreeId(), name, wincoin, totalbet) log := model.NewBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId, this.GetGameFreeId(), name, wincoin, totalbet)
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.InsertBurstJackpotLogs(log) return model.InsertBurstJackpotLogs(log)
}), nil, "InsertBurstJackpotLogs").Start() }), nil, "InsertBurstJackpotLogs").Start()
@ -226,7 +226,7 @@ func (this *EasterIslandSceneData) RecordBurstLog(name string, wincoin, totalbet
func (this *EasterIslandSceneData) BurstHistory(player *EasterIslandPlayerData) { func (this *EasterIslandSceneData) BurstHistory(player *EasterIslandPlayerData) {
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.GetBurstJackpotLog(this.Platform, this.DbGameFree.GameId) return model.GetBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId)
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
var logsp []*easterisland.EasterIslandBurstHistoryInfo var logsp []*easterisland.EasterIslandBurstHistoryInfo
if data != nil { if data != nil {
@ -254,7 +254,7 @@ func (this *EasterIslandSceneData) GetLastBurstJackPot() time.Time {
} }
func (this *EasterIslandSceneData) SetLastBurstJackPot() { func (this *EasterIslandSceneData) SetLastBurstJackPot() {
var randT = rand.Intn(25200-7200+1) + 7200 var randT = rand.Intn(25200-7200+1) + 7200
switch this.DbGameFree.SceneType { switch this.GetDBGameFree().SceneType {
case 1: case 1:
randT = rand.Intn(25200-7200+1) + 7200 randT = rand.Intn(25200-7200+1) + 7200
case 2: case 2:
@ -269,7 +269,7 @@ func (this *EasterIslandSceneData) SetLastBurstJackPot() {
func (this *EasterIslandSceneData) AIAddJackPot() { func (this *EasterIslandSceneData) AIAddJackPot() {
if time.Now().Sub(this.lastJackPot) > 0 { if time.Now().Sub(this.lastJackPot) > 0 {
var randT = rand.Intn(3) + 1 var randT = rand.Intn(3) + 1
switch this.DbGameFree.SceneType { switch this.GetDBGameFree().SceneType {
case 1: case 1:
randT = rand.Intn(3) + 1 randT = rand.Intn(3) + 1
case 2: case 2:
@ -282,20 +282,20 @@ func (this *EasterIslandSceneData) AIAddJackPot() {
randT = rand.Intn(3) + 1 randT = rand.Intn(3) + 1
} }
this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT)) this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT))
val := int64(math.Floor(float64(this.DbGameFree.GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000)) val := int64(math.Floor(float64(this.GetDBGameFree().GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
this.jackpot.VirtualJK += val this.jackpot.VirtualJK += val
} }
} }
func (this *EasterIslandSceneData) AIBurstJackPot() { func (this *EasterIslandSceneData) AIBurstJackPot() {
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 { if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
this.SetLastBurstJackPot() this.SetLastBurstJackPot()
jackpotParams := this.DbGameFree.GetJackpot() jackpotParams := this.GetDBGameFree().GetJackpot()
var jackpotInit = int64(jackpotParams[rule.EL_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) //奖池初始值 var jackpotInit = int64(jackpotParams[rule.EL_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) //奖池初始值
//AI机器人爆奖 //AI机器人爆奖
val := this.jackpot.VirtualJK val := this.jackpot.VirtualJK
this.jackpot.VirtualJK = jackpotInit this.jackpot.VirtualJK = jackpotInit
bet := int64(this.DbGameFree.GetBaseScore()) * int64(rule.LINENUM) bet := int64(this.GetDBGameFree().GetBaseScore()) * int64(rule.LINENUM)
this.RecordBurstLog(this.RandNickName(), val, bet) this.RecordBurstLog(this.RandNickName(), val, bet)
} }
} }
@ -316,11 +316,11 @@ func (this *EasterIslandSceneData) KickPlayerByTime() {
} }
//for _, p := range this.players { //for _, p := range this.players {
// //游戏次数达到目标值 // //游戏次数达到目标值
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId())) // todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.GetDBGameFree().GetId()))
// if !p.IsRob && // if !p.IsRob &&
// todayGamefreeIDSceneData != nil && // todayGamefreeIDSceneData != nil &&
// this.DbGameFree.GetPlayNumLimit() != 0 && // this.GetDBGameFree().GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) { // todayGamefreeIDSceneData.GameTimes >= int64(this.GetDBGameFree().GetPlayNumLimit()) {
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true) // this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
// } // }
//} //}

View File

@ -94,8 +94,8 @@ func (this *ScenePolicyEasterIsland) OnPlayerEnter(s *base.Scene, p *base.Player
logger.Logger.Trace("(this *ScenePolicyEasterIsland) OnPlayerEnter, sceneId=", s.SceneId, " player=", p.SnId) logger.Logger.Trace("(this *ScenePolicyEasterIsland) OnPlayerEnter, sceneId=", s.SceneId, " player=", p.SnId)
if sceneEx, ok := s.ExtraData.(*EasterIslandSceneData); ok { if sceneEx, ok := s.ExtraData.(*EasterIslandSceneData); ok {
playerEx := &EasterIslandPlayerData{Player: p} playerEx := &EasterIslandPlayerData{Player: p}
playerEx.init(s) // 玩家当前信息初始化 playerEx.init(s) // 玩家当前信息初始化
playerEx.score = sceneEx.DbGameFree.GetBaseScore() // 底注 playerEx.score = sceneEx.GetDBGameFree().GetBaseScore() // 底注
sceneEx.players[p.SnId] = playerEx sceneEx.players[p.SnId] = playerEx
p.ExtraData = playerEx p.ExtraData = playerEx
EasterIslandSendRoomInfo(s, p, sceneEx, playerEx, nil) EasterIslandSendRoomInfo(s, p, sceneEx, playerEx, nil)
@ -230,14 +230,14 @@ func (this *ScenePolicyEasterIsland) GetJackPotVal(s *base.Scene) int64 {
func EasterIslandSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *EasterIslandSceneData, playerEx *EasterIslandPlayerData, data *easterisland.GameBilledData) { func EasterIslandSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *EasterIslandSceneData, playerEx *EasterIslandPlayerData, data *easterisland.GameBilledData) {
logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId) logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId)
pack := &easterisland.SCEasterIslandRoomInfo{ pack := &easterisland.SCEasterIslandRoomInfo{
RoomId: proto.Int(s.SceneId), RoomId: s.SceneId,
Creator: proto.Int32(s.Creator), Creator: proto.Int32(s.Creator),
GameId: proto.Int(s.GameId), GameId: s.GameId,
RoomMode: proto.Int(s.GameMode), RoomMode: s.GameMode,
Params: common.CopySliceInt64ToInt32(s.Params), Params: common.CopySliceInt64ToInt32(s.Params),
State: proto.Int(s.SceneState.GetState()), State: proto.Int(s.SceneState.GetState()),
Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK), Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK),
GameFreeId: proto.Int32(s.DbGameFree.Id), GameFreeId: proto.Int32(s.GetDBGameFree().Id),
BilledData: data, BilledData: data,
} }
if playerEx != nil { if playerEx != nil {
@ -256,7 +256,7 @@ func EasterIslandSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *EasterIsla
//} //}
pack.BetLines = playerEx.betLines pack.BetLines = playerEx.betLines
pack.FreeTimes = proto.Int32(playerEx.freeTimes) pack.FreeTimes = proto.Int32(playerEx.freeTimes)
pack.Chip = proto.Int32(s.DbGameFree.BaseScore) pack.Chip = proto.Int32(s.GetDBGameFree().BaseScore)
pack.SpinID = proto.Int64(playerEx.spinID) pack.SpinID = proto.Int64(playerEx.spinID)
if playerEx.totalPriceBonus > 0 { if playerEx.totalPriceBonus > 0 {
switch playerEx.bonusStage { switch playerEx.bonusStage {
@ -367,7 +367,7 @@ func (this *SceneStateEasterIslandStart) OnPlayerOp(s *base.Scene, p *base.Playe
return false return false
} }
//先做底注校验 //先做底注校验
if sceneEx.DbGameFree.GetBaseScore() != int32(params[0]) { if sceneEx.GetDBGameFree().GetBaseScore() != int32(params[0]) {
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_Error, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_Error, params)
return false return false
} }
@ -401,7 +401,7 @@ func (this *SceneStateEasterIslandStart) OnPlayerOp(s *base.Scene, p *base.Playe
if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin { if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin {
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_CoinNotEnough, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_CoinNotEnough, params)
return false return false
} else if playerEx.freeTimes <= 0 && int64(sceneEx.DbGameFree.GetBetLimit()) > playerEx.Coin { //押注限制 } else if playerEx.freeTimes <= 0 && int64(sceneEx.GetDBGameFree().GetBetLimit()) > playerEx.Coin { //押注限制
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_CoinNotEnough, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_CoinNotEnough, params)
return false return false
} }
@ -413,7 +413,7 @@ func (this *SceneStateEasterIslandStart) OnPlayerOp(s *base.Scene, p *base.Playe
//获取当前水池的上下文环境 //获取当前水池的上下文环境
sceneEx.CpCtx = base.CoinPoolMgr.GetCoinPoolCtx(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId) sceneEx.CpCtx = base.CoinPoolMgr.GetCoinPoolCtx(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId)
taxRate := sceneEx.DbGameFree.GetTaxRate() taxRate := sceneEx.GetDBGameFree().GetTaxRate()
if taxRate < 0 || taxRate > 10000 { if taxRate < 0 || taxRate > 10000 {
logger.Logger.Warnf("EasterIslandErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate) logger.Logger.Warnf("EasterIslandErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate)
taxRate = 500 taxRate = 500
@ -430,9 +430,9 @@ func (this *SceneStateEasterIslandStart) OnPlayerOp(s *base.Scene, p *base.Playe
} else { } else {
gamePoolCoin = base.CoinPoolMgr.GetCoin(sceneEx.GetGameFreeId(), sceneEx.Platform, sceneEx.GroupId) // 当前水池金额 gamePoolCoin = base.CoinPoolMgr.GetCoin(sceneEx.GetGameFreeId(), sceneEx.Platform, sceneEx.GroupId) // 当前水池金额
} }
prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额 prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额
jackpotParams := sceneEx.DbGameFree.GetJackpot() // 奖池参数 jackpotParams := sceneEx.GetDBGameFree().GetJackpot() // 奖池参数
var jackpotInit = int64(jackpotParams[rule.EL_JACKPOT_InitJackpot]) * int64(sceneEx.DbGameFree.GetBaseScore()) //奖池初始值 var jackpotInit = int64(jackpotParams[rule.EL_JACKPOT_InitJackpot]) * int64(sceneEx.GetDBGameFree().GetBaseScore()) //奖池初始值
var jackpotFundAdd, prizeFundAdd int64 var jackpotFundAdd, prizeFundAdd int64
if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注 if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注
@ -449,7 +449,7 @@ func (this *SceneStateEasterIslandStart) OnPlayerOp(s *base.Scene, p *base.Playe
////统计参与游戏次数 ////统计参与游戏次数
//if !sceneEx.Testing && !playerEx.IsRob { //if !sceneEx.Testing && !playerEx.IsRob {
// pack := &server.GWSceneEnd{ // pack := &server.GWSceneEnd{
// GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()), // GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
// Players: []*server.PlayerCtx{&server.PlayerCtx{SnId: proto.Int32(playerEx.SnId), Coin: proto.Int64(playerEx.Coin)}}, // Players: []*server.PlayerCtx{&server.PlayerCtx{SnId: proto.Int32(playerEx.SnId), Coin: proto.Int64(playerEx.Coin)}},
// } // }
// proto.SetDefaults(pack) // proto.SetDefaults(pack)
@ -629,7 +629,7 @@ func (this *SceneStateEasterIslandStart) OnPlayerOp(s *base.Scene, p *base.Playe
case EasterIslandPlayerHistory: case EasterIslandPlayerHistory:
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
spinid := strconv.FormatInt(int64(playerEx.SnId), 10) spinid := strconv.FormatInt(int64(playerEx.SnId), 10)
gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.DbGameFree.GetGameClass(), s.GameId) gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.GetDBGameFree().GetGameClass(), int(s.GameId))
pack := &easterisland.SCEasterIslandPlayerHistory{} pack := &easterisland.SCEasterIslandPlayerHistory{}
for _, v := range gpl.Data { for _, v := range gpl.Data {
//if v.GameDetailedLogId == "" { //if v.GameDetailedLogId == "" {
@ -819,7 +819,7 @@ func (this *SceneStateEasterIslandStart) WinTargetBenchTest(s *base.Scene, p *ba
} }
file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,中线倍数,中线数,剩余免费次数\r\n") file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,中线倍数,中线数,剩余免费次数\r\n")
oldCoin := p.Coin oldCoin := p.Coin
switch s.DbGameFree.GetSceneType() { switch s.GetDBGameFree().GetSceneType() {
case 1: case 1:
p.Coin = 100000 p.Coin = 100000
case 2: case 2:
@ -873,7 +873,7 @@ func EasterIslandCheckAndSaveLog(sceneEx *EasterIslandSceneData, playerEx *Easte
//log2 //log2
playerEx.RollGameType.BaseResult.ChangeCoin = changeCoin playerEx.RollGameType.BaseResult.ChangeCoin = changeCoin
playerEx.RollGameType.BaseResult.BasicBet = sceneEx.DbGameFree.GetBaseScore() playerEx.RollGameType.BaseResult.BasicBet = sceneEx.GetDBGameFree().GetBaseScore()
playerEx.RollGameType.BaseResult.RoomId = int32(sceneEx.SceneId) playerEx.RollGameType.BaseResult.RoomId = int32(sceneEx.SceneId)
playerEx.RollGameType.BaseResult.AfterCoin = playerEx.Coin playerEx.RollGameType.BaseResult.AfterCoin = playerEx.Coin
playerEx.RollGameType.BaseResult.BeforeCoin = startCoin playerEx.RollGameType.BaseResult.BeforeCoin = startCoin
@ -932,8 +932,8 @@ func EasterIslandCheckAndSaveLog(sceneEx *EasterIslandSceneData, playerEx *Easte
GameCoinTs: proto.Int64(playerEx.GameCoinTs), GameCoinTs: proto.Int64(playerEx.GameCoinTs),
} }
gwPlayerBet := &server.GWPlayerData{ gwPlayerBet := &server.GWPlayerData{
SceneId: proto.Int(sceneEx.SceneId), SceneId: sceneEx.SceneId,
GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()), GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
} }
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet) gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
sceneEx.SyncPlayerDatas(&base.PlayerDataParam{ sceneEx.SyncPlayerDatas(&base.PlayerDataParam{

View File

@ -406,7 +406,7 @@ func (this *CSFishSkillUseReqHandler) Process(s *netlib.Session, packetid int, d
status := false status := false
for _, s := range strSlice { for _, s := range strSlice {
num, _ := strconv.Atoi(s) num, _ := strconv.Atoi(s)
if num == player.GetScene().SceneType { if int32(num) == player.GetScene().GetSceneType() {
status = true status = true
} }
} }
@ -414,7 +414,7 @@ func (this *CSFishSkillUseReqHandler) Process(s *netlib.Session, packetid int, d
pack.Result = 1 pack.Result = 1
pack.Status = fishing_proto.SCFishSkillUseResp_ROOM_DISALLOW pack.Status = fishing_proto.SCFishSkillUseResp_ROOM_DISALLOW
player.SendToClient(int(fishing_proto.FIPacketID_FISHING_SC_SKILLUSERESP), pack) player.SendToClient(int(fishing_proto.FIPacketID_FISHING_SC_SKILLUSERESP), pack)
fishlogger.Trace("当前房间不允许使用此技能 skillId = %v,sceneType = %v", skillId, player.GetScene().SceneType) fishlogger.Trace("当前房间不允许使用此技能 skillId = %v,sceneType = %v", skillId, player.GetScene().GetSceneType())
return nil return nil
} }
//判断当前技能在不在CD中 //判断当前技能在不在CD中
@ -516,7 +516,7 @@ func (this *CSSkillListReqHandler) Process(s *netlib.Session, packetid int, data
pack := &fishing_proto.SCSkillListResp{} pack := &fishing_proto.SCSkillListResp{}
for _, skill := range srvdata.PBDB_FishSkillMgr.Datas.Arr { for _, skill := range srvdata.PBDB_FishSkillMgr.Datas.Arr {
//获取房间类型 //获取房间类型
sceneType := player.GetScene().SceneType sceneType := player.GetScene().GetSceneType()
str := skill.Hidden str := skill.Hidden
num, err := strconv.Atoi(str) num, err := strconv.Atoi(str)
status := true status := true

View File

@ -300,7 +300,7 @@ func (this *FishingPlayerData) SaveDetailedLog(s *base.Scene) {
GameCoinTs: proto.Int64(this.GameCoinTs), GameCoinTs: proto.Int64(this.GameCoinTs),
} }
gwPlayerData := &server_proto.GWPlayerData{ gwPlayerData := &server_proto.GWPlayerData{
SceneId: proto.Int(sceneEx.SceneId), SceneId: sceneEx.SceneId,
GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()), GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
} }
gwPlayerData.Datas = append(gwPlayerData.Datas, playerBet) gwPlayerData.Datas = append(gwPlayerData.Datas, playerBet)

View File

@ -108,7 +108,7 @@ func (this *FishingSceneData) init() bool {
this.SetPlayerNum(4) this.SetPlayerNum(4)
this.gameId = this.GetGameId() this.gameId = this.GetGameId()
this.platform = this.GetPlatform() this.platform = this.GetPlatform()
this.sceneType = int(this.DbGameFree.GetSceneType()) this.sceneType = int(this.GetDBGameFree().GetSceneType())
this.keyGameId = this.GetKeyGameId() this.keyGameId = this.GetKeyGameId()
this.testing = this.GetTesting() this.testing = this.GetTesting()
this.gamefreeId = this.GetGameFreeId() this.gamefreeId = this.GetGameFreeId()
@ -904,7 +904,7 @@ func (this *FishingSceneData) fishSettlements(fishs []*Fish, player *FishingPlay
} }
//BOSS鱼死亡 更新BOSS池和个人池 //BOSS鱼死亡 更新BOSS池和个人池
if value.IsBoss == fishing.Boss { if value.IsBoss == fishing.Boss {
bossPond := base.GetCoinPoolMgr().GetBossPond(this.DbGameFree.SceneType) bossPond := base.GetCoinPoolMgr().GetBossPond(this.GetDBGameFree().SceneType)
this.isBossDie(player, int64(dropCoin), bossPond) this.isBossDie(player, int64(dropCoin), bossPond)
} }
@ -1507,7 +1507,7 @@ func (this *FishingSceneData) AddBossPond(player *FishingPlayerData, fishtype in
// 减掉个人池数值 // 减掉个人池数值
if score > 0 { if score > 0 {
player.MoneyPond -= score player.MoneyPond -= score
base.GetCoinPoolMgr().AddBossPond(this.DbGameFree.SceneType, score) base.GetCoinPoolMgr().AddBossPond(this.GetDBGameFree().SceneType, score)
} }
} }
@ -1521,7 +1521,7 @@ func (this *FishingSceneData) isBossDie(player *FishingPlayerData, score int64,
minNum = bossPond minNum = bossPond
} }
player.MoneyPond += minNum player.MoneyPond += minNum
base.GetCoinPoolMgr().AddBossPond(this.DbGameFree.SceneType, -minNum) base.GetCoinPoolMgr().AddBossPond(this.GetDBGameFree().SceneType, -minNum)
fishlogger.Infof("玩家:%vBoss奖池剩余金币数量%v\n", player.SnId, bossPond) fishlogger.Infof("玩家:%vBoss奖池剩余金币数量%v\n", player.SnId, bossPond)
} }

View File

@ -101,7 +101,7 @@ func (p *FruitsPlayerData) Clear() {
p.weightPos = 0 p.weightPos = 0
} }
func (p *FruitsPlayerData) TestCode(eleLineAppearRate [][]int32, sceneEx *FruitsSceneData) bool { func (p *FruitsPlayerData) TestCode(eleLineAppearRate [][]int32, sceneEx *FruitsSceneData) bool {
//if sceneEx.DbGameFree.GetId() == 3060004 { //if sceneEx.GetDBGameFree().GetId() == 3060004 {
// p.result.CreateLine(eleLineAppearRate, p.gameState == fruits.FreeGame) // p.result.CreateLine(eleLineAppearRate, p.gameState == fruits.FreeGame)
// if p.testIdx == 1 { // if p.testIdx == 1 {
// //test mary // //test mary
@ -186,7 +186,7 @@ func (p *FruitsPlayerData) CreateResult(eleLineAppearRate [][]int32, sceneEx *Fr
case 5: case 5:
winjackpot = int64(math.Ceil(float64(JackPotVal) * 0.4 / float64(fruits.NowByte))) winjackpot = int64(math.Ceil(float64(JackPotVal) * 0.4 / float64(fruits.NowByte)))
} }
if winjackpot < int64(sceneEx.DbGameFree.GetJackpotMin())*fruits.NowByte { if winjackpot < int64(sceneEx.GetDBGameFree().GetJackpotMin())*fruits.NowByte {
isNeed = false isNeed = false
break break
} }

View File

@ -40,7 +40,7 @@ func NewFruitsSceneData(s *base.Scene) *FruitsSceneData {
func (s *FruitsSceneData) Init() { func (s *FruitsSceneData) Init() {
s.LoadJackPotData() s.LoadJackPotData()
//for _, data := range srvdata.PBDB_SlotRateWeightMgr.Datas.Arr { //for _, data := range srvdata.PBDB_SlotRateWeightMgr.Datas.Arr {
// if data.Id == s.DbGameFree.Id { // if data.Id == s.GetDBGameFree().Id {
// //s.levelRate = append(s.levelRate, data.EleWeight1) // //s.levelRate = append(s.levelRate, data.EleWeight1)
// //s.slotRateWeightTotal = append(s.slotRateWeightTotal, data.EleWeight1, data.EleWeight2, data.EleWeight3, data.EleWeight4, data.EleWeight5) // //s.slotRateWeightTotal = append(s.slotRateWeightTotal, data.EleWeight1, data.EleWeight2, data.EleWeight3, data.EleWeight4, data.EleWeight5)
// } // }
@ -59,12 +59,12 @@ func (s *FruitsSceneData) SceneDestroy(force bool) {
} }
func (s *FruitsSceneData) AddPrizeCoin(playerEx *FruitsPlayerData) { func (s *FruitsSceneData) AddPrizeCoin(playerEx *FruitsPlayerData) {
val := playerEx.betCoin val := playerEx.betCoin
tax := int64(math.Ceil(float64(val) * float64(s.DbGameFree.GetTaxRate()) / 10000)) tax := int64(math.Ceil(float64(val) * float64(s.GetDBGameFree().GetTaxRate()) / 10000))
//playerEx.taxCoin = tax //playerEx.taxCoin = tax
//playerEx.AddServiceFee(tax) //playerEx.AddServiceFee(tax)
val -= tax val -= tax
addPrizeCoin := int64(math.Floor(float64(val*fruits.NowByte*int64(s.DbGameFree.GetJackpotRatio())) / 1000)) //扩大10000倍 addPrizeCoin := int64(math.Floor(float64(val*fruits.NowByte*int64(s.GetDBGameFree().GetJackpotRatio())) / 1000)) //扩大10000倍
s.jackpot.AddToSmall(playerEx.IsRob, addPrizeCoin) s.jackpot.AddToSmall(playerEx.IsRob, addPrizeCoin)
logger.Logger.Tracef("奖池增加...AddPrizeCoin... %f", float64(addPrizeCoin)/float64(fruits.NowByte)) logger.Logger.Tracef("奖池增加...AddPrizeCoin... %f", float64(addPrizeCoin)/float64(fruits.NowByte))
base.SlotsPoolMgr.SetPool(s.GetGameFreeId(), s.Platform, s.jackpot) base.SlotsPoolMgr.SetPool(s.GetGameFreeId(), s.Platform, s.jackpot)
@ -95,7 +95,7 @@ func (s *FruitsSceneData) OnPlayerLeave(p *base.Player, reason int) {
if playerEx.winCoin != 0 { if playerEx.winCoin != 0 {
//SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, playerEx.winCoin) //SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, playerEx.winCoin)
p.Statics(s.KeyGameId, s.KeyGamefreeId, playerEx.winCoin, false) p.Statics(s.KeyGameId, s.KeyGamefreeId, playerEx.winCoin, false)
//tax := int64(math.Ceil(float64(playerEx.winCoin) * float64(s.DbGameFree.GetTaxRate()) / 10000)) //tax := int64(math.Ceil(float64(playerEx.winCoin) * float64(s.GetDBGameFree().GetTaxRate()) / 10000))
//playerEx.taxCoin = tax //playerEx.taxCoin = tax
//playerEx.winCoin -= tax //playerEx.winCoin -= tax
//p.AddServiceFee(tax) //p.AddServiceFee(tax)
@ -140,7 +140,7 @@ func (s *FruitsSceneData) Win(p *FruitsPlayerData) {
p.noWinTimes = 0 p.noWinTimes = 0
//SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.winCoin) //SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.winCoin)
p.Statics(s.KeyGameId, s.KeyGamefreeId, p.winCoin, false) p.Statics(s.KeyGameId, s.KeyGamefreeId, p.winCoin, false)
//tax := int64(math.Ceil(float64(p.winCoin) * float64(s.DbGameFree.GetTaxRate()) / 10000)) //tax := int64(math.Ceil(float64(p.winCoin) * float64(s.GetDBGameFree().GetTaxRate()) / 10000))
//p.taxCoin = tax //p.taxCoin = tax
//p.winCoin -= tax //p.winCoin -= tax
//p.AddServiceFee(tax) //p.AddServiceFee(tax)
@ -210,7 +210,7 @@ func (s *FruitsSceneData) LoadJackPotData() {
base.SlotsPoolMgr.SetPool(s.GetGameFreeId(), s.Platform, s.jackpot) base.SlotsPoolMgr.SetPool(s.GetGameFreeId(), s.Platform, s.jackpot)
} else { } else {
s.jackpot = &base.SlotJackpotPool{} s.jackpot = &base.SlotJackpotPool{}
jp := s.DbGameFree.GetJackpot() jp := s.GetDBGameFree().GetJackpot()
if len(jp) > 0 { if len(jp) > 0 {
s.jackpot.Small += int64(jp[0] * 10000) s.jackpot.Small += int64(jp[0] * 10000)
} }
@ -244,7 +244,7 @@ func (s *FruitsSceneData) SaveLog(p *FruitsPlayerData, isOffline int) {
} }
} }
FruitsType := model.FruitsType{ FruitsType := model.FruitsType{
RoomId: s.SceneId, RoomId: int(s.SceneId),
BasicScore: int32(p.oneBetCoin), BasicScore: int32(p.oneBetCoin),
PlayerSnId: p.SnId, PlayerSnId: p.SnId,
BeforeCoin: p.startCoin, BeforeCoin: p.startCoin,
@ -372,7 +372,7 @@ func (s *FruitsSceneData) SendPlayerBet(p *FruitsPlayerData) {
Tax: proto.Int64(p.taxCoin), Tax: proto.Int64(p.taxCoin),
} }
gwPlayerBet := &server.GWPlayerData{ gwPlayerBet := &server.GWPlayerData{
GameFreeId: proto.Int32(s.DbGameFree.GetId()), GameFreeId: proto.Int32(s.GetDBGameFree().GetId()),
} }
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet) gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
s.SyncPlayerDatas(&base.PlayerDataParam{ s.SyncPlayerDatas(&base.PlayerDataParam{
@ -604,8 +604,8 @@ func (s *FruitsSceneData) GetEleWeight(needpos int32) (norms, frees, marys [][]i
curCoin := base.CoinPoolMgr.GetCoin(s.GetGameFreeId(), s.Platform, s.GroupId) curCoin := base.CoinPoolMgr.GetCoin(s.GetGameFreeId(), s.Platform, s.GroupId)
curCoin = int64(math.Floor(float64(curCoin) / float64(fruits.NowByte))) curCoin = int64(math.Floor(float64(curCoin) / float64(fruits.NowByte)))
for i := len(s.DbGameFree.BalanceLine) - 1; i >= 0; i-- { for i := len(s.GetDBGameFree().BalanceLine) - 1; i >= 0; i-- {
balance := s.DbGameFree.BalanceLine[i] balance := s.GetDBGameFree().BalanceLine[i]
if curCoin >= int64(balance) { if curCoin >= int64(balance) {
key = int32(i) key = int32(i)
break break

View File

@ -148,16 +148,16 @@ func FruitsSendRoomInfo(s *base.Scene, sceneEx *FruitsSceneData, playerEx *Fruit
func FruitsCreateRoomInfoPacket(s *base.Scene, sceneEx *FruitsSceneData, playerEx *FruitsPlayerData) interface{} { func FruitsCreateRoomInfoPacket(s *base.Scene, sceneEx *FruitsSceneData, playerEx *FruitsPlayerData) interface{} {
//房间信息 //房间信息
pack := &protocol.SCFruitsRoomInfo{ pack := &protocol.SCFruitsRoomInfo{
RoomId: proto.Int(s.SceneId), RoomId: s.SceneId,
GameId: proto.Int(s.GameId), GameId: s.GameId,
RoomMode: proto.Int(s.SceneMode), RoomMode: s.SceneMode,
SceneType: proto.Int(s.SceneType), SceneType: s.GetSceneType(),
Params: common.CopySliceInt64ToInt32(s.Params), Params: common.CopySliceInt64ToInt32(s.Params),
NumOfGames: proto.Int(sceneEx.NumOfGames), NumOfGames: proto.Int(sceneEx.NumOfGames),
State: proto.Int(s.SceneState.GetState()), State: proto.Int(s.SceneState.GetState()),
ParamsEx: s.DbGameFree.OtherIntParams, ParamsEx: s.GetDBGameFree().OtherIntParams,
GameFreeId: proto.Int32(s.DbGameFree.Id), GameFreeId: proto.Int32(s.GetDBGameFree().Id),
//BetLimit: s.DbGameFree.BetLimit, //BetLimit: s.GetDBGameFree().BetLimit,
} }
//自己的信息 //自己的信息
@ -299,11 +299,11 @@ func (this *SceneBaseStateFruits) OnTick(s *base.Scene) {
if sceneEx, ok := s.ExtraData.(*FruitsSceneData); ok { if sceneEx, ok := s.ExtraData.(*FruitsSceneData); ok {
//for _, p := range sceneEx.players { //for _, p := range sceneEx.players {
// //游戏次数达到目标值 // //游戏次数达到目标值
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(sceneEx.DbGameFree.GetId())) // todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(sceneEx.GetDBGameFree().GetId()))
// if !p.IsRob && // if !p.IsRob &&
// todayGamefreeIDSceneData != nil && // todayGamefreeIDSceneData != nil &&
// sceneEx.DbGameFree.GetPlayNumLimit() != 0 && // sceneEx.GetDBGameFree().GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(sceneEx.DbGameFree.GetPlayNumLimit()) { // todayGamefreeIDSceneData.GameTimes >= int64(sceneEx.GetDBGameFree().GetPlayNumLimit()) {
// s.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true) // s.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
// } // }
//} //}
@ -397,7 +397,7 @@ func (this *SceneStateStartFruits) OnPlayerOp(s *base.Scene, p *base.Player, opc
//只有开始算操作 //只有开始算操作
p.LastOPTimer = time.Now() p.LastOPTimer = time.Now()
idx := int(params[0]) idx := int(params[0])
if len(sceneEx.DbGameFree.GetOtherIntParams()) <= idx { if len(sceneEx.GetDBGameFree().GetOtherIntParams()) <= idx {
pack := &protocol.SCFruitsOp{ pack := &protocol.SCFruitsOp{
OpCode: proto.Int(opcode), OpCode: proto.Int(opcode),
OpRetCode: proto.Int(3), OpRetCode: proto.Int(3),
@ -419,12 +419,12 @@ func (this *SceneStateStartFruits) OnPlayerOp(s *base.Scene, p *base.Player, opc
if playerEx.gameState == fruits.Normal { if playerEx.gameState == fruits.Normal {
playerEx.freeTotal = 0 playerEx.freeTotal = 0
playerEx.betIdx = idx playerEx.betIdx = idx
playerEx.betCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[idx]) playerEx.betCoin = int64(sceneEx.GetDBGameFree().GetOtherIntParams()[idx])
playerEx.oneBetCoin = playerEx.betCoin / 9 playerEx.oneBetCoin = playerEx.betCoin / 9
//playerEx.isReportGameEvent = true //playerEx.isReportGameEvent = true
playerEx.noWinTimes++ playerEx.noWinTimes++
if playerEx.Coin < int64(s.DbGameFree.GetBetLimit()) { if playerEx.Coin < int64(s.GetDBGameFree().GetBetLimit()) {
//押注限制(低于该值不能押注) //押注限制(低于该值不能押注)
pack := &protocol.SCFruitsOp{ pack := &protocol.SCFruitsOp{
OpCode: proto.Int(opcode), OpCode: proto.Int(opcode),
@ -486,9 +486,9 @@ func (this *SceneStateStartFruits) OnPlayerOp(s *base.Scene, p *base.Player, opc
case fruits.FruitsPlayerOpSwitch: case fruits.FruitsPlayerOpSwitch:
if len(params) > 0 && playerEx.freeTimes == 0 && playerEx.maryFreeTimes == 0 { if len(params) > 0 && playerEx.freeTimes == 0 && playerEx.maryFreeTimes == 0 {
idx := int(params[0]) idx := int(params[0])
if len(sceneEx.DbGameFree.GetOtherIntParams()) > idx { if len(sceneEx.GetDBGameFree().GetOtherIntParams()) > idx {
playerEx.betIdx = idx playerEx.betIdx = idx
playerEx.betCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[idx]) playerEx.betCoin = int64(sceneEx.GetDBGameFree().GetOtherIntParams()[idx])
playerEx.oneBetCoin = playerEx.betCoin / 9 playerEx.oneBetCoin = playerEx.betCoin / 9
} }
} }

View File

@ -67,7 +67,7 @@ func (this *IceAgeSceneData) init() bool {
this.jackpot = &base.SlotJackpotPool{} this.jackpot = &base.SlotJackpotPool{}
if this.jackpot.Small <= 0 { if this.jackpot.Small <= 0 {
this.jackpot.Small = 0 this.jackpot.Small = 0
this.jackpot.VirtualJK = int64(params[rule.ICEAGE_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) this.jackpot.VirtualJK = int64(params[rule.ICEAGE_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore())
} }
str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.GetPlatform()) str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.GetPlatform())
@ -238,7 +238,7 @@ func (this *IceAgeSceneData) BroadcastJackpot(sync bool) {
this.lastJackpotValue = this.jackpot.VirtualJK this.lastJackpotValue = this.jackpot.VirtualJK
pack := &gamehall.SCHundredSceneGetGameJackpot{} pack := &gamehall.SCHundredSceneGetGameJackpot{}
jpfi := &gamehall.GameJackpotFundInfo{ jpfi := &gamehall.GameJackpotFundInfo{
GameFreeId: proto.Int32(this.DbGameFree.Id), GameFreeId: proto.Int32(this.GetDBGameFree().Id),
JackPotFund: proto.Int64(this.jackpot.VirtualJK), JackPotFund: proto.Int64(this.jackpot.VirtualJK),
} }
pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi) pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi)
@ -264,7 +264,7 @@ func (this *IceAgeSceneData) PopCoinPool(winCoin int64, IsNovice bool) {
} }
} }
func (this *IceAgeSceneData) RecordBurstLog(name string, wincoin, totalbet int64) { func (this *IceAgeSceneData) RecordBurstLog(name string, wincoin, totalbet int64) {
log := model.NewBurstJackpotLog(this.Platform, this.DbGameFree.GameId, this.GetGameFreeId(), name, wincoin, totalbet) log := model.NewBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId, this.GetGameFreeId(), name, wincoin, totalbet)
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.InsertBurstJackpotLogs(log) return model.InsertBurstJackpotLogs(log)
}), nil, "InsertBurstJackpotLogs").Start() }), nil, "InsertBurstJackpotLogs").Start()
@ -272,7 +272,7 @@ func (this *IceAgeSceneData) RecordBurstLog(name string, wincoin, totalbet int64
func (this *IceAgeSceneData) BurstHistory(player *IceAgePlayerData) { func (this *IceAgeSceneData) BurstHistory(player *IceAgePlayerData) {
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.GetBurstJackpotLog(this.Platform, this.DbGameFree.GameId) return model.GetBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId)
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
var logsp []*iceage.IceAgeBurstHistoryInfo var logsp []*iceage.IceAgeBurstHistoryInfo
if data != nil { if data != nil {
@ -300,7 +300,7 @@ func (this *IceAgeSceneData) GetLastBurstJackPot() time.Time {
} }
func (this *IceAgeSceneData) SetLastBurstJackPot() { func (this *IceAgeSceneData) SetLastBurstJackPot() {
var randT = rand.Intn(25200-7200+1) + 7200 var randT = rand.Intn(25200-7200+1) + 7200
switch this.DbGameFree.SceneType { switch this.GetDBGameFree().SceneType {
case 1: case 1:
randT = rand.Intn(25200-7200+1) + 7200 randT = rand.Intn(25200-7200+1) + 7200
case 2: case 2:
@ -313,7 +313,7 @@ func (this *IceAgeSceneData) SetLastBurstJackPot() {
func (this *IceAgeSceneData) AIAddJackPot() { func (this *IceAgeSceneData) AIAddJackPot() {
if time.Now().Sub(this.lastJackPot) > 0 { if time.Now().Sub(this.lastJackPot) > 0 {
var randT = rand.Intn(3) + 1 var randT = rand.Intn(3) + 1
switch this.DbGameFree.SceneType { switch this.GetDBGameFree().SceneType {
case 1: case 1:
randT = rand.Intn(3) + 1 randT = rand.Intn(3) + 1
case 2: case 2:
@ -324,20 +324,20 @@ func (this *IceAgeSceneData) AIAddJackPot() {
randT = rand.Intn(3) + 1 randT = rand.Intn(3) + 1
} }
this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT)) this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT))
val := int64(math.Floor(float64(this.DbGameFree.GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000)) val := int64(math.Floor(float64(this.GetDBGameFree().GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
this.jackpot.VirtualJK += val this.jackpot.VirtualJK += val
} }
} }
func (this *IceAgeSceneData) AIBurstJackPot() { func (this *IceAgeSceneData) AIBurstJackPot() {
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 { if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
this.SetLastBurstJackPot() this.SetLastBurstJackPot()
jackpotParams := this.DbGameFree.GetJackpot() jackpotParams := this.GetDBGameFree().GetJackpot()
var jackpotInit = int64(jackpotParams[rule.ICEAGE_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) //奖池初始值 var jackpotInit = int64(jackpotParams[rule.ICEAGE_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) //奖池初始值
//AI机器人爆奖 //AI机器人爆奖
val := this.jackpot.VirtualJK val := this.jackpot.VirtualJK
this.jackpot.VirtualJK = jackpotInit this.jackpot.VirtualJK = jackpotInit
bet := int64(this.DbGameFree.GetBaseScore()) * int64(rule.LINENUM) bet := int64(this.GetDBGameFree().GetBaseScore()) * int64(rule.LINENUM)
this.RecordBurstLog(this.RandNickName(), val, bet) this.RecordBurstLog(this.RandNickName(), val, bet)
} }
} }
@ -358,11 +358,11 @@ func (this *IceAgeSceneData) KickPlayerByTime() {
} }
//for _, p := range this.players { //for _, p := range this.players {
// //游戏次数达到目标值 // //游戏次数达到目标值
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId())) // todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.GetDBGameFree().GetId()))
// if !p.IsRob && // if !p.IsRob &&
// todayGamefreeIDSceneData != nil && // todayGamefreeIDSceneData != nil &&
// this.DbGameFree.GetPlayNumLimit() != 0 && // this.GetDBGameFree().GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) { // todayGamefreeIDSceneData.GameTimes >= int64(this.GetDBGameFree().GetPlayNumLimit()) {
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true) // this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
// } // }
//} //}

View File

@ -253,7 +253,7 @@ func IceAgeSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *IceAgeSceneData,
pack.Players = append(pack.Players, pd) pack.Players = append(pack.Players, pd)
pack.BetLines = playerEx.betLines pack.BetLines = playerEx.betLines
pack.FreeTimes = proto.Int32(playerEx.freeTimes) pack.FreeTimes = proto.Int32(playerEx.freeTimes)
pack.Chip = proto.Int32(s.DbGameFree.BaseScore) pack.Chip = proto.Int32(s.GetDBGameFree().BaseScore)
pack.TotalPriceBonus = proto.Int64(playerEx.totalPriceBonus) pack.TotalPriceBonus = proto.Int64(playerEx.totalPriceBonus)
pack.SpinID = proto.Int64(playerEx.spinID) pack.SpinID = proto.Int64(playerEx.spinID)
} }
@ -681,7 +681,7 @@ func (this *SceneStateIceAgeStart) OnPlayerOp(s *base.Scene, p *base.Player, opc
case IceAgePlayerHistory: case IceAgePlayerHistory:
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
spinid := strconv.FormatInt(int64(playerEx.SnId), 10) spinid := strconv.FormatInt(int64(playerEx.SnId), 10)
gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.DbGameFree.GetGameClass(), s.GetGameId()) gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.GetDBGameFree().GetGameClass(), s.GetGameId())
pack := &iceage.SCIceAgePlayerHistory{} pack := &iceage.SCIceAgePlayerHistory{}
for _, v := range gpl.Data { for _, v := range gpl.Data {
//if v.GameDetailedLogId == "" { //if v.GameDetailedLogId == "" {
@ -982,7 +982,7 @@ func IceAgeCheckAndSaveLog(sceneEx *IceAgeSceneData, playerEx *IceAgePlayerData)
GameCoinTs: proto.Int64(playerEx.GameCoinTs), GameCoinTs: proto.Int64(playerEx.GameCoinTs),
} }
gwPlayerBet := &server.GWPlayerData{ gwPlayerBet := &server.GWPlayerData{
SceneId: proto.Int(sceneEx.SceneId), SceneId: sceneEx.SceneId,
GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()), GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
} }
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet) gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)

View File

@ -58,13 +58,13 @@ func (s *RichBlessedSceneData) SceneDestroy(force bool) {
} }
func (s *RichBlessedSceneData) AddPrizeCoin(playerEx *RichBlessedPlayerData) { func (s *RichBlessedSceneData) AddPrizeCoin(playerEx *RichBlessedPlayerData) {
val := playerEx.betCoin val := playerEx.betCoin
tax := int64(math.Ceil(float64(val) * float64(s.DbGameFree.GetTaxRate()) / 10000)) tax := int64(math.Ceil(float64(val) * float64(s.GetDBGameFree().GetTaxRate()) / 10000))
//playerEx.taxCoin = tax //playerEx.taxCoin = tax
//playerEx.AddServiceFee(tax) //playerEx.AddServiceFee(tax)
val -= tax val -= tax
addPrizeCoin := val * richblessed.NowByte * int64(s.DbGameFree.GetJackpotRatio()) //扩大10000倍 addPrizeCoin := val * richblessed.NowByte * int64(s.GetDBGameFree().GetJackpotRatio()) //扩大10000倍
jk1 := int64(math.Floor(float64(addPrizeCoin) / 1000 / 4)) //千分之奖池比例 分四份 jk1 := int64(math.Floor(float64(addPrizeCoin) / 1000 / 4)) //千分之奖池比例 分四份
s.jackpot.AddToGrand(playerEx.IsRob, jk1) s.jackpot.AddToGrand(playerEx.IsRob, jk1)
s.jackpot.AddToBig(playerEx.IsRob, jk1) s.jackpot.AddToBig(playerEx.IsRob, jk1)
s.jackpot.AddToMiddle(playerEx.IsRob, jk1) s.jackpot.AddToMiddle(playerEx.IsRob, jk1)
@ -177,7 +177,7 @@ func (s *RichBlessedSceneData) Win(p *RichBlessedPlayerData) {
p.noWinTimes = 0 p.noWinTimes = 0
//SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.winCoin) //SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.winCoin)
p.Statics(s.KeyGameId, s.KeyGamefreeId, p.winCoin, false) p.Statics(s.KeyGameId, s.KeyGamefreeId, p.winCoin, false)
//tax := int64(math.Ceil(float64(p.winCoin) * float64(s.DbGameFree.GetTaxRate()) / 10000)) //tax := int64(math.Ceil(float64(p.winCoin) * float64(s.GetDBGameFree().GetTaxRate()) / 10000))
//p.taxCoin = tax //p.taxCoin = tax
//p.winCoin -= tax //p.winCoin -= tax
//p.AddServiceFee(tax) //p.AddServiceFee(tax)
@ -198,7 +198,7 @@ func (s *RichBlessedSceneData) JACKPOTWin(p *RichBlessedPlayerData) {
p.noWinTimes = 0 p.noWinTimes = 0
//SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.JackwinCoin) //SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.JackwinCoin)
p.Statics(s.KeyGameId, s.KeyGamefreeId, p.JackwinCoin, false) p.Statics(s.KeyGameId, s.KeyGamefreeId, p.JackwinCoin, false)
//tax := int64(math.Ceil(float64(p.JackwinCoin) * float64(s.DbGameFree.GetTaxRate()) / 10000)) //tax := int64(math.Ceil(float64(p.JackwinCoin) * float64(s.GetDBGameFree().GetTaxRate()) / 10000))
//p.taxCoin = tax //p.taxCoin = tax
//p.JackwinCoin -= tax //p.JackwinCoin -= tax
//p.AddServiceFee(tax) //p.AddServiceFee(tax)
@ -271,7 +271,7 @@ func (s *RichBlessedSceneData) LoadJackPotData() {
base.SlotsPoolMgr.SetPool(s.GetGameFreeId(), s.Platform, s.jackpot) base.SlotsPoolMgr.SetPool(s.GetGameFreeId(), s.Platform, s.jackpot)
} else { } else {
s.jackpot = &base.SlotJackpotPool{} s.jackpot = &base.SlotJackpotPool{}
jp := s.DbGameFree.GetJackpot() jp := s.GetDBGameFree().GetJackpot()
if len(jp) > 0 { if len(jp) > 0 {
s.jackpot.Small += int64(jp[0] * 10000) s.jackpot.Small += int64(jp[0] * 10000)
} }
@ -300,7 +300,7 @@ func (s *RichBlessedSceneData) SaveLog(p *RichBlessedPlayerData, isOffline int)
} }
RichBlessed := model.RichBlessedType{ RichBlessed := model.RichBlessedType{
RoomId: s.SceneId, RoomId: int(s.SceneId),
BasicScore: int32(p.oneBetCoin), BasicScore: int32(p.oneBetCoin),
PlayerSnId: p.SnId, PlayerSnId: p.SnId,
BeforeCoin: p.startCoin, BeforeCoin: p.startCoin,
@ -388,8 +388,8 @@ func (s *RichBlessedSceneData) GetEleWeight(needpos int32) (norms, frees [][]int
curCoin := base.CoinPoolMgr.GetCoin(s.GetGameFreeId(), s.Platform, s.GroupId) curCoin := base.CoinPoolMgr.GetCoin(s.GetGameFreeId(), s.Platform, s.GroupId)
curCoin = int64(math.Floor(float64(curCoin) / float64(richblessed.NowByte))) curCoin = int64(math.Floor(float64(curCoin) / float64(richblessed.NowByte)))
for i := len(s.DbGameFree.BalanceLine) - 1; i >= 0; i-- { for i := len(s.GetDBGameFree().BalanceLine) - 1; i >= 0; i-- {
balance := s.DbGameFree.BalanceLine[i] balance := s.GetDBGameFree().BalanceLine[i]
if curCoin >= int64(balance) { if curCoin >= int64(balance) {
key = int32(i) key = int32(i)
break break
@ -426,7 +426,7 @@ func (s *RichBlessedSceneData) GetEleWeight(needpos int32) (norms, frees [][]int
} }
func (s *RichBlessedSceneData) CreateResult(eleLineAppearRate [][]int32, playerEx *RichBlessedPlayerData) { func (s *RichBlessedSceneData) CreateResult(eleLineAppearRate [][]int32, playerEx *RichBlessedPlayerData) {
//if s.DbGameFree.GetId() == 3070004 { //if s.GetDBGameFree().GetId() == 3070004 {
// playerEx.TestCode(eleLineAppearRate) // playerEx.TestCode(eleLineAppearRate)
//} else { //} else {
playerEx.result.CreateLine(eleLineAppearRate) playerEx.result.CreateLine(eleLineAppearRate)
@ -448,7 +448,7 @@ func (s *RichBlessedSceneData) SendPlayerBet(p *RichBlessedPlayerData) {
GameCoinTs: p.GameCoinTs, GameCoinTs: p.GameCoinTs,
} }
gwPlayerBet := &server.GWPlayerData{ gwPlayerBet := &server.GWPlayerData{
GameFreeId: proto.Int32(s.DbGameFree.GetId()), GameFreeId: proto.Int32(s.GetDBGameFree().GetId()),
SceneId: int32(s.SceneId), SceneId: int32(s.SceneId),
} }
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet) gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)

View File

@ -71,7 +71,7 @@ func (this *ScenePolicyRichBlessed) OnPlayerEnter(s *base.Scene, p *base.Player)
if s == nil || p == nil { if s == nil || p == nil {
return return
} }
logger.Logger.Trace("(this *ScenePolicyRichBlessed) OnPlayerEnter, sceneId=", s.GetSceneId(), " player=", p.Name, "bet:", s.DbGameFree.GetOtherIntParams()) logger.Logger.Trace("(this *ScenePolicyRichBlessed) OnPlayerEnter, sceneId=", s.GetSceneId(), " player=", p.Name, "bet:", s.GetDBGameFree().GetOtherIntParams())
if sceneEx, ok := s.GetExtraData().(*RichBlessedSceneData); ok { if sceneEx, ok := s.GetExtraData().(*RichBlessedSceneData); ok {
playerEx := &RichBlessedPlayerData{Player: p} playerEx := &RichBlessedPlayerData{Player: p}
playerEx.init() playerEx.init()
@ -148,15 +148,15 @@ func RichBlessedSendRoomInfo(s *base.Scene, sceneEx *RichBlessedSceneData, playe
func RichBlessedCreateRoomInfoPacket(s *base.Scene, sceneEx *RichBlessedSceneData, playerEx *RichBlessedPlayerData) interface{} { func RichBlessedCreateRoomInfoPacket(s *base.Scene, sceneEx *RichBlessedSceneData, playerEx *RichBlessedPlayerData) interface{} {
//房间信息 //房间信息
pack := &protocol.SCRBRoomInfo{ pack := &protocol.SCRBRoomInfo{
RoomId: proto.Int(s.SceneId), RoomId: s.SceneId,
GameId: proto.Int(s.GameId), GameId: s.GameId,
RoomMode: proto.Int(s.SceneMode), RoomMode: s.SceneMode,
SceneType: proto.Int(s.SceneType), SceneType: s.GetSceneType(),
Params: common.CopySliceInt64ToInt32(s.Params), Params: common.CopySliceInt64ToInt32(s.Params),
NumOfGames: proto.Int(sceneEx.NumOfGames), NumOfGames: proto.Int(sceneEx.NumOfGames),
State: proto.Int(s.SceneState.GetState()), State: proto.Int(s.SceneState.GetState()),
ParamsEx: common.Int64ToInt32(s.DbGameFree.OtherIntParams), //s.GetParamsEx(), ParamsEx: common.Int64ToInt32(s.GetDBGameFree().OtherIntParams), //s.GetParamsEx(),
//BetLimit: s.DbGameFree.BetLimit, //BetLimit: s.GetDBGameFree().BetLimit,
NowGameState: proto.Int(playerEx.gameState), NowGameState: proto.Int(playerEx.gameState),
BetIdx: proto.Int(playerEx.betIdx), BetIdx: proto.Int(playerEx.betIdx),
@ -172,11 +172,11 @@ func RichBlessedCreateRoomInfoPacket(s *base.Scene, sceneEx *RichBlessedSceneDat
WinFreeTimes: proto.Int32(int32(playerEx.nowFreeTimes)), WinFreeTimes: proto.Int32(int32(playerEx.nowFreeTimes)),
JackpotEle: proto.Int32(playerEx.result.JackpotEle), JackpotEle: proto.Int32(playerEx.result.JackpotEle),
WinJackpot: proto.Int64(playerEx.JackwinCoin), WinJackpot: proto.Int64(playerEx.JackwinCoin),
GameFreeId: proto.Int32(s.DbGameFree.Id), GameFreeId: proto.Int32(s.GetDBGameFree().Id),
} }
if playerEx.oneBetCoin == 0 && len(s.DbGameFree.GetOtherIntParams()) != 0 { // 初始化客户端jack显示 if playerEx.oneBetCoin == 0 && len(s.GetDBGameFree().GetOtherIntParams()) != 0 { // 初始化客户端jack显示
oneBetCoin := int64(s.DbGameFree.GetOtherIntParams()[0] / richblessed.LineNum) oneBetCoin := int64(s.GetDBGameFree().GetOtherIntParams()[0] / richblessed.LineNum)
pack.SmallJackpot = oneBetCoin * richblessed.JkEleNumRate[richblessed.BlueGirl] pack.SmallJackpot = oneBetCoin * richblessed.JkEleNumRate[richblessed.BlueGirl]
pack.MiddleJackpot = oneBetCoin * richblessed.JkEleNumRate[richblessed.BlueBoy] pack.MiddleJackpot = oneBetCoin * richblessed.JkEleNumRate[richblessed.BlueBoy]
pack.BigJackpot = oneBetCoin * richblessed.JkEleNumRate[richblessed.GoldGirl] pack.BigJackpot = oneBetCoin * richblessed.JkEleNumRate[richblessed.GoldGirl]
@ -302,11 +302,11 @@ func (this *SceneBaseStateRichBlessed) OnTick(s *base.Scene) {
if sceneEx, ok := s.ExtraData.(*RichBlessedSceneData); ok { if sceneEx, ok := s.ExtraData.(*RichBlessedSceneData); ok {
//for _, p := range sceneEx.players { //for _, p := range sceneEx.players {
// //游戏次数达到目标值 // //游戏次数达到目标值
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(sceneEx.DbGameFree.GetId())) // todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(sceneEx.GetDBGameFree().GetId()))
// if !p.IsRob && // if !p.IsRob &&
// todayGamefreeIDSceneData != nil && // todayGamefreeIDSceneData != nil &&
// sceneEx.DbGameFree.GetPlayNumLimit() != 0 && // sceneEx.GetDBGameFree().GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(sceneEx.DbGameFree.GetPlayNumLimit()) { // todayGamefreeIDSceneData.GameTimes >= int64(sceneEx.GetDBGameFree().GetPlayNumLimit()) {
// s.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true) // s.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
// } // }
//} //}
@ -401,7 +401,7 @@ func (this *SceneStateStartRichBlessed) OnPlayerOp(s *base.Scene, p *base.Player
//只有开始算操作 //只有开始算操作
p.LastOPTimer = time.Now() p.LastOPTimer = time.Now()
idx := int(params[0]) idx := int(params[0])
if len(sceneEx.DbGameFree.GetOtherIntParams()) <= idx { if len(sceneEx.GetDBGameFree().GetOtherIntParams()) <= idx {
pack := &protocol.SCRichBlessedOp{ pack := &protocol.SCRichBlessedOp{
OpCode: proto.Int(opcode), OpCode: proto.Int(opcode),
OpRetCode: proto.Int(3), OpRetCode: proto.Int(3),
@ -423,13 +423,13 @@ func (this *SceneStateStartRichBlessed) OnPlayerOp(s *base.Scene, p *base.Player
if playerEx.gameState == richblessed.Normal { if playerEx.gameState == richblessed.Normal {
logger.Logger.Tracef("(this *SceneStateStartRichBlessed) OnPlayerOp, 下注 %v %v %v", playerEx.betCoin, playerEx.maxbetCoin, playerEx.oneBetCoin) logger.Logger.Tracef("(this *SceneStateStartRichBlessed) OnPlayerOp, 下注 %v %v %v", playerEx.betCoin, playerEx.maxbetCoin, playerEx.oneBetCoin)
playerEx.betIdx = idx playerEx.betIdx = idx
playerEx.betCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[idx]) playerEx.betCoin = int64(sceneEx.GetDBGameFree().GetOtherIntParams()[idx])
maxidx := len(sceneEx.DbGameFree.GetOtherIntParams()) - 1 maxidx := len(sceneEx.GetDBGameFree().GetOtherIntParams()) - 1
playerEx.maxbetCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[maxidx]) playerEx.maxbetCoin = int64(sceneEx.GetDBGameFree().GetOtherIntParams()[maxidx])
playerEx.oneBetCoin = playerEx.betCoin / richblessed.LineNum // 单注 playerEx.oneBetCoin = playerEx.betCoin / richblessed.LineNum // 单注
playerEx.noWinTimes++ playerEx.noWinTimes++
if playerEx.Coin < int64(s.DbGameFree.GetBetLimit()) { if playerEx.Coin < int64(s.GetDBGameFree().GetBetLimit()) {
//押注限制(低于该值不能押注) //押注限制(低于该值不能押注)
pack := &protocol.SCRichBlessedOp{ pack := &protocol.SCRichBlessedOp{
OpCode: proto.Int(opcode), OpCode: proto.Int(opcode),
@ -495,9 +495,9 @@ func (this *SceneStateStartRichBlessed) OnPlayerOp(s *base.Scene, p *base.Player
case richblessed.RichBlessedPlayerOpSwitch: case richblessed.RichBlessedPlayerOpSwitch:
if len(params) > 0 && playerEx.freeTimes == 0 { if len(params) > 0 && playerEx.freeTimes == 0 {
idx := int(params[0]) idx := int(params[0])
if len(sceneEx.DbGameFree.GetOtherIntParams()) > idx { if len(sceneEx.GetDBGameFree().GetOtherIntParams()) > idx {
playerEx.betIdx = idx playerEx.betIdx = idx
playerEx.betCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[idx]) playerEx.betCoin = int64(sceneEx.GetDBGameFree().GetOtherIntParams()[idx])
playerEx.oneBetCoin = playerEx.betCoin / richblessed.LineNum playerEx.oneBetCoin = playerEx.betCoin / richblessed.LineNum
pack := &protocol.SCRichBlessedOp{ pack := &protocol.SCRichBlessedOp{
OpCode: proto.Int(opcode), OpCode: proto.Int(opcode),

View File

@ -271,15 +271,15 @@ func (this *SceneEx) init() bool {
} }
func (this *SceneEx) GetBaseScore() int32 { //游戏底分 func (this *SceneEx) GetBaseScore() int32 { //游戏底分
if this.DbGameFree != nil { if this.GetDBGameFree() != nil {
return this.DbGameFree.GetBaseScore() return this.GetDBGameFree().GetBaseScore()
} }
return 1 return 1
} }
func (this *SceneEx) GetBetMaxCoin() int32 { //游戏底分 func (this *SceneEx) GetBetMaxCoin() int32 { //游戏底分
if this.DbGameFree != nil { if this.GetDBGameFree() != nil {
return this.DbGameFree.GetBaseScore() * 10000 return this.GetDBGameFree().GetBaseScore() * 10000
} }
return 1 * 10000 return 1 * 10000
} }

View File

@ -52,14 +52,14 @@ func (this *TamQuocSceneData) SceneDestroy(force bool) {
} }
func (this *TamQuocSceneData) init() bool { func (this *TamQuocSceneData) init() bool {
if this.DbGameFree == nil { if this.GetDBGameFree() == nil {
return false return false
} }
params := this.DbGameFree.GetJackpot() params := this.GetDBGameFree().GetJackpot()
this.jackpot = &base.SlotJackpotPool{} this.jackpot = &base.SlotJackpotPool{}
if this.jackpot.Small <= 0 { if this.jackpot.Small <= 0 {
this.jackpot.Small = 0 this.jackpot.Small = 0
this.jackpot.VirtualJK = int64(params[rule.TAMQUOC_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) this.jackpot.VirtualJK = int64(params[rule.TAMQUOC_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore())
} }
str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform) str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform)
if str != "" { if str != "" {
@ -95,7 +95,7 @@ type TamQuocSpinResult struct {
} }
func (this *TamQuocSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes TamQuocSpinResult) { func (this *TamQuocSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes TamQuocSpinResult) {
taxRate := this.DbGameFree.GetTaxRate() taxRate := this.GetDBGameFree().GetTaxRate()
calcTaxScore := func(score int64, taxScore *int64) int64 { calcTaxScore := func(score int64, taxScore *int64) int64 {
newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0) newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0)
if taxScore != nil { if taxScore != nil {
@ -114,7 +114,7 @@ func (this *TamQuocSceneData) CalcLinePrize(cards []int, betLines []int64, betVa
if spinRes.TotalPrizeJackpot == 0 { // 第一个爆奖 获取当前奖池所有 if spinRes.TotalPrizeJackpot == 0 { // 第一个爆奖 获取当前奖池所有
prizeJackpot = this.jackpot.VirtualJK prizeJackpot = this.jackpot.VirtualJK
} else { // 之后的爆奖 奖励为奖池初值 } else { // 之后的爆奖 奖励为奖池初值
prizeJackpot = int64(this.DbGameFree.GetJackpot()[rule.TAMQUOC_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) prizeJackpot = int64(this.GetDBGameFree().GetJackpot()[rule.TAMQUOC_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore())
} }
prizeJackpot = calcTaxScore(prizeJackpot, &spinRes.TotalTaxScore) prizeJackpot = calcTaxScore(prizeJackpot, &spinRes.TotalTaxScore)
spinRes.TotalPrizeJackpot += prizeJackpot spinRes.TotalPrizeJackpot += prizeJackpot
@ -177,7 +177,7 @@ func (this *TamQuocSceneData) BroadcastJackpot(sync bool) {
this.lastJackpotValue = this.jackpot.VirtualJK this.lastJackpotValue = this.jackpot.VirtualJK
pack := &gamehall.SCHundredSceneGetGameJackpot{} pack := &gamehall.SCHundredSceneGetGameJackpot{}
jpfi := &gamehall.GameJackpotFundInfo{ jpfi := &gamehall.GameJackpotFundInfo{
GameFreeId: proto.Int32(this.DbGameFree.Id), GameFreeId: proto.Int32(this.GetDBGameFree().Id),
JackPotFund: proto.Int64(this.jackpot.VirtualJK), JackPotFund: proto.Int64(this.jackpot.VirtualJK),
} }
pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi) pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi)
@ -204,7 +204,7 @@ func (this *TamQuocSceneData) PopCoinPool(winCoin int64, IsNovice bool) {
} }
} }
func (this *TamQuocSceneData) RecordBurstLog(name string, wincoin, totalbet int64) { func (this *TamQuocSceneData) RecordBurstLog(name string, wincoin, totalbet int64) {
log := model.NewBurstJackpotLog(this.Platform, this.DbGameFree.GameId, this.GetGameFreeId(), name, wincoin, totalbet) log := model.NewBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId, this.GetGameFreeId(), name, wincoin, totalbet)
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.InsertBurstJackpotLogs(log) return model.InsertBurstJackpotLogs(log)
}), nil, "InsertBurstJackpotLogs").Start() }), nil, "InsertBurstJackpotLogs").Start()
@ -212,7 +212,7 @@ func (this *TamQuocSceneData) RecordBurstLog(name string, wincoin, totalbet int6
func (this *TamQuocSceneData) BurstHistory(player *TamQuocPlayerData) { func (this *TamQuocSceneData) BurstHistory(player *TamQuocPlayerData) {
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.GetBurstJackpotLog(this.Platform, this.DbGameFree.GameId) return model.GetBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId)
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
var logsp []*tamquoc.TamQuocBurstHistoryInfo var logsp []*tamquoc.TamQuocBurstHistoryInfo
if data != nil { if data != nil {
@ -240,7 +240,7 @@ func (this *TamQuocSceneData) GetLastBurstJackPot() time.Time {
} }
func (this *TamQuocSceneData) SetLastBurstJackPot() { func (this *TamQuocSceneData) SetLastBurstJackPot() {
var randT = rand.Intn(25200-7200+1) + 7200 var randT = rand.Intn(25200-7200+1) + 7200
switch this.DbGameFree.SceneType { switch this.GetDBGameFree().SceneType {
case 1: case 1:
randT = rand.Intn(25200-7200+1) + 7200 randT = rand.Intn(25200-7200+1) + 7200
case 2: case 2:
@ -254,7 +254,7 @@ func (this *TamQuocSceneData) SetLastBurstJackPot() {
func (this *TamQuocSceneData) AIAddJackPot() { func (this *TamQuocSceneData) AIAddJackPot() {
if time.Now().Sub(this.lastJackPot) > 0 { if time.Now().Sub(this.lastJackPot) > 0 {
var randT = rand.Intn(3) + 1 var randT = rand.Intn(3) + 1
switch this.DbGameFree.SceneType { switch this.GetDBGameFree().SceneType {
case 1: case 1:
randT = rand.Intn(3) + 1 randT = rand.Intn(3) + 1
case 2: case 2:
@ -265,20 +265,20 @@ func (this *TamQuocSceneData) AIAddJackPot() {
randT = rand.Intn(3) + 1 randT = rand.Intn(3) + 1
} }
this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT)) this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT))
val := int64(math.Floor(float64(this.DbGameFree.GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000)) val := int64(math.Floor(float64(this.GetDBGameFree().GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
this.jackpot.VirtualJK += val this.jackpot.VirtualJK += val
} }
} }
func (this *TamQuocSceneData) AIBurstJackPot() { func (this *TamQuocSceneData) AIBurstJackPot() {
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 { if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
this.SetLastBurstJackPot() this.SetLastBurstJackPot()
jackpotParams := this.DbGameFree.GetJackpot() jackpotParams := this.GetDBGameFree().GetJackpot()
var jackpotInit = int64(jackpotParams[rule.TAMQUOC_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) //奖池初始值 var jackpotInit = int64(jackpotParams[rule.TAMQUOC_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) //奖池初始值
//AI机器人爆奖 //AI机器人爆奖
val := this.jackpot.VirtualJK val := this.jackpot.VirtualJK
this.jackpot.VirtualJK = jackpotInit this.jackpot.VirtualJK = jackpotInit
bet := int64(this.DbGameFree.GetBaseScore()) * int64(rule.LINENUM) bet := int64(this.GetDBGameFree().GetBaseScore()) * int64(rule.LINENUM)
this.RecordBurstLog(this.RandNickName(), val, int64(bet)) this.RecordBurstLog(this.RandNickName(), val, int64(bet))
} }
} }
@ -299,11 +299,11 @@ func (this *TamQuocSceneData) KickPlayerByTime() {
} }
//for _, p := range this.players { //for _, p := range this.players {
// //游戏次数达到目标值 // //游戏次数达到目标值
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId())) // todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.GetDBGameFree().GetId()))
// if !p.IsRob && // if !p.IsRob &&
// todayGamefreeIDSceneData != nil && // todayGamefreeIDSceneData != nil &&
// this.DbGameFree.GetPlayNumLimit() != 0 && // this.GetDBGameFree().GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) { // todayGamefreeIDSceneData.GameTimes >= int64(this.GetDBGameFree().GetPlayNumLimit()) {
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true) // this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
// } // }
//} //}

View File

@ -90,8 +90,8 @@ func (this *ScenePolicyTamQuoc) OnPlayerEnter(s *base.Scene, p *base.Player) {
logger.Logger.Trace("(this *ScenePolicyTamQuoc) OnPlayerEnter, sceneId=", s.SceneId, " player=", p.SnId) logger.Logger.Trace("(this *ScenePolicyTamQuoc) OnPlayerEnter, sceneId=", s.SceneId, " player=", p.SnId)
if sceneEx, ok := s.ExtraData.(*TamQuocSceneData); ok { if sceneEx, ok := s.ExtraData.(*TamQuocSceneData); ok {
playerEx := &TamQuocPlayerData{Player: p} playerEx := &TamQuocPlayerData{Player: p}
playerEx.init(s) // 玩家当前信息初始化 playerEx.init(s) // 玩家当前信息初始化
playerEx.score = sceneEx.DbGameFree.GetBaseScore() // 底注 playerEx.score = sceneEx.GetDBGameFree().GetBaseScore() // 底注
sceneEx.players[p.SnId] = playerEx sceneEx.players[p.SnId] = playerEx
p.ExtraData = playerEx p.ExtraData = playerEx
TamQuocSendRoomInfo(s, p, sceneEx, playerEx, nil) TamQuocSendRoomInfo(s, p, sceneEx, playerEx, nil)
@ -226,10 +226,10 @@ func (this *ScenePolicyTamQuoc) GetJackPotVal(s *base.Scene) int64 {
func TamQuocSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *TamQuocSceneData, playerEx *TamQuocPlayerData, data *tamquoc.GameBilledData) { func TamQuocSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *TamQuocSceneData, playerEx *TamQuocPlayerData, data *tamquoc.GameBilledData) {
logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId) logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId)
pack := &tamquoc.SCTamQuocRoomInfo{ pack := &tamquoc.SCTamQuocRoomInfo{
RoomId: proto.Int(s.SceneId), RoomId: s.SceneId,
Creator: proto.Int32(s.Creator), Creator: proto.Int32(s.Creator),
GameId: proto.Int(s.GameId), GameId: s.GameId,
RoomMode: proto.Int(s.GameMode), RoomMode: s.GameMode,
Params: common.CopySliceInt64ToInt32(s.Params), Params: common.CopySliceInt64ToInt32(s.Params),
State: proto.Int(s.SceneState.GetState()), State: proto.Int(s.SceneState.GetState()),
Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK), Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK),
@ -252,7 +252,7 @@ func TamQuocSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *TamQuocSceneDat
//} //}
pack.BetLines = playerEx.betLines pack.BetLines = playerEx.betLines
pack.FreeTimes = proto.Int32(playerEx.freeTimes) pack.FreeTimes = proto.Int32(playerEx.freeTimes)
pack.Chip = proto.Int32(s.DbGameFree.BaseScore) pack.Chip = proto.Int32(s.GetDBGameFree().BaseScore)
pack.SpinID = proto.Int64(playerEx.spinID) pack.SpinID = proto.Int64(playerEx.spinID)
if playerEx.totalPriceBonus > 0 && playerEx.bonusGameStartTime.Add(TamQuocBonusGamePickTime).Before(time.Now()) { if playerEx.totalPriceBonus > 0 && playerEx.bonusGameStartTime.Add(TamQuocBonusGamePickTime).Before(time.Now()) {
playerEx.totalPriceBonus = 0 playerEx.totalPriceBonus = 0
@ -339,7 +339,7 @@ func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, op
return false return false
} }
//先做底注校验 //先做底注校验
if sceneEx.DbGameFree.GetBaseScore() != int32(params[0]) { if sceneEx.GetDBGameFree().GetBaseScore() != int32(params[0]) {
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_Error, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_Error, params)
return false return false
} }
@ -373,7 +373,7 @@ func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, op
if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin { if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin {
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_CoinNotEnough, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_CoinNotEnough, params)
return false return false
} else if playerEx.freeTimes <= 0 && int64(sceneEx.DbGameFree.GetBetLimit()) > playerEx.Coin { //押注限制 } else if playerEx.freeTimes <= 0 && int64(sceneEx.GetDBGameFree().GetBetLimit()) > playerEx.Coin { //押注限制
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_CoinNotEnough, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_CoinNotEnough, params)
return false return false
} }
@ -388,7 +388,7 @@ func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, op
sceneEx.CpCtx = base.CoinPoolMgr.GetCoinPoolCtx(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId) sceneEx.CpCtx = base.CoinPoolMgr.GetCoinPoolCtx(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId)
//税收比例 //税收比例
taxRate := sceneEx.DbGameFree.GetTaxRate() taxRate := sceneEx.GetDBGameFree().GetTaxRate()
if taxRate < 0 || taxRate > 10000 { if taxRate < 0 || taxRate > 10000 {
logger.Logger.Tracef("TamQuocErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate) logger.Logger.Tracef("TamQuocErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate)
taxRate = 500 taxRate = 500
@ -410,8 +410,8 @@ func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, op
prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额 prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额
// 奖池参数 // 奖池参数
var jackpotParam = sceneEx.DbGameFree.GetJackpot() var jackpotParam = sceneEx.GetDBGameFree().GetJackpot()
var jackpotInit = int64(jackpotParam[rule.TAMQUOC_JACKPOT_InitJackpot]) * int64(sceneEx.DbGameFree.GetBaseScore()) //奖池初始值 var jackpotInit = int64(jackpotParam[rule.TAMQUOC_JACKPOT_InitJackpot]) * int64(sceneEx.GetDBGameFree().GetBaseScore()) //奖池初始值
var jackpotFundAdd, prizeFundAdd int64 var jackpotFundAdd, prizeFundAdd int64
if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注 if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注
@ -431,7 +431,7 @@ func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, op
//统计参与游戏次数 //统计参与游戏次数
//if !sceneEx.Testing && !playerEx.IsRob { //if !sceneEx.Testing && !playerEx.IsRob {
// pack := &server.GWSceneEnd{ // pack := &server.GWSceneEnd{
// GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()), // GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
// Players: []*server.PlayerCtx{&server.PlayerCtx{SnId: proto.Int32(playerEx.SnId), Coin: proto.Int64(playerEx.Coin)}}, // Players: []*server.PlayerCtx{&server.PlayerCtx{SnId: proto.Int32(playerEx.SnId), Coin: proto.Int64(playerEx.Coin)}},
// } // }
// proto.SetDefaults(pack) // proto.SetDefaults(pack)
@ -454,11 +454,11 @@ func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, op
var slotDataIsOk bool var slotDataIsOk bool
for i := 0; i < 3; i++ { for i := 0; i < 3; i++ {
slotData = rule.GenerateSlotsData_v2(symbolType) slotData = rule.GenerateSlotsData_v2(symbolType)
//if sceneEx.DbGameFree.GetSceneType() == 1 { //if sceneEx.GetDBGameFree().GetSceneType() == 1 {
// slotData = []int{1, 1, 1, 1, 1, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7} // slotData = []int{1, 1, 1, 1, 1, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7}
//} //}
spinRes = sceneEx.CalcLinePrize(slotData, playerEx.betLines, params[0]) spinRes = sceneEx.CalcLinePrize(slotData, playerEx.betLines, params[0])
//if sceneEx.DbGameFree.GetSceneType() == 1 { //if sceneEx.GetDBGameFree().GetSceneType() == 1 {
// slotDataIsOk = true // slotDataIsOk = true
// break // break
//} //}
@ -641,7 +641,7 @@ func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, op
case TamQuocPlayerHistory: case TamQuocPlayerHistory:
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
spinid := strconv.FormatInt(int64(playerEx.SnId), 10) spinid := strconv.FormatInt(int64(playerEx.SnId), 10)
gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.DbGameFree.GetGameClass(), s.GameId) gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.GetDBGameFree().GetGameClass(), int(s.GameId))
pack := &tamquoc.SCTamQuocPlayerHistory{} pack := &tamquoc.SCTamQuocPlayerHistory{}
for _, v := range gpl.Data { for _, v := range gpl.Data {
//if v.GameDetailedLogId == "" { //if v.GameDetailedLogId == "" {
@ -759,7 +759,7 @@ func TamQuocCheckAndSaveLog(sceneEx *TamQuocSceneData, playerEx *TamQuocPlayerDa
//log2 //log2
playerEx.RollGameType.BaseResult.ChangeCoin = changeCoin playerEx.RollGameType.BaseResult.ChangeCoin = changeCoin
playerEx.RollGameType.BaseResult.BasicBet = sceneEx.DbGameFree.GetBaseScore() playerEx.RollGameType.BaseResult.BasicBet = sceneEx.GetDBGameFree().GetBaseScore()
playerEx.RollGameType.BaseResult.RoomId = int32(sceneEx.SceneId) playerEx.RollGameType.BaseResult.RoomId = int32(sceneEx.SceneId)
playerEx.RollGameType.BaseResult.AfterCoin = playerEx.Coin playerEx.RollGameType.BaseResult.AfterCoin = playerEx.Coin
playerEx.RollGameType.BaseResult.BeforeCoin = startCoin playerEx.RollGameType.BaseResult.BeforeCoin = startCoin
@ -818,8 +818,8 @@ func TamQuocCheckAndSaveLog(sceneEx *TamQuocSceneData, playerEx *TamQuocPlayerDa
GameCoinTs: proto.Int64(playerEx.GameCoinTs), GameCoinTs: proto.Int64(playerEx.GameCoinTs),
} }
gwPlayerBet := &server.GWPlayerData{ gwPlayerBet := &server.GWPlayerData{
SceneId: proto.Int(sceneEx.SceneId), SceneId: sceneEx.SceneId,
GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()), GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
} }
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet) gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
sceneEx.SyncPlayerDatas(&base.PlayerDataParam{ sceneEx.SyncPlayerDatas(&base.PlayerDataParam{

View File

@ -368,15 +368,15 @@ func (this *SceneEx) ThirteenWaterCreateRoomInfoPacket(s *base.Scene, p *base.Pl
} }
func (this *SceneEx) GetBaseScore() int64 { //游戏底分 func (this *SceneEx) GetBaseScore() int64 { //游戏底分
if this.DbGameFree.FreeMode == 1 { if this.GetDBGameFree().FreeMode == 1 {
baseScore := this.GetParam(rule.ParamBaseScore) baseScore := this.GetParam(rule.ParamBaseScore)
if baseScore > 0 { if baseScore > 0 {
return baseScore return baseScore
} }
} }
if this.DbGameFree != nil { if this.GetDBGameFree() != nil {
return int64(this.DbGameFree.GetBaseScore()) return int64(this.GetDBGameFree().GetBaseScore())
} }
return 1 return 1
} }
@ -1268,7 +1268,7 @@ func (this *SceneEx) CountBilled() {
} }
if playerEx.gainCoin > 0 { if playerEx.gainCoin > 0 {
gainCoin := playerEx.gainCoin gainCoin := playerEx.gainCoin
playerEx.gainCoin = playerEx.gainCoin * int64(10000-this.DbGameFree.GetTaxRate()) / 10000 playerEx.gainCoin = playerEx.gainCoin * int64(10000-this.GetDBGameFree().GetTaxRate()) / 10000
playerEx.taxCoin = gainCoin - playerEx.gainCoin playerEx.taxCoin = gainCoin - playerEx.gainCoin
} }
logger.Logger.Tracef("玩家分数 %v, coin:%v tax:%v win:%v", playerEx.SnId, playerEx.gainCoin, playerEx.taxCoin, playerEx.winAllPlayers) logger.Logger.Tracef("玩家分数 %v, coin:%v tax:%v win:%v", playerEx.SnId, playerEx.gainCoin, playerEx.taxCoin, playerEx.winAllPlayers)
@ -1334,7 +1334,7 @@ func (this *SceneEx) SendHandCardOdds() {
if seat.IsRob { if seat.IsRob {
robotPlayers = append(robotPlayers, seat) robotPlayers = append(robotPlayers, seat)
} else { } else {
seat.odds = this.GetPlayerOdds(seat.Player, this.GameId, this.robotNum > 0) seat.odds = this.GetPlayerOdds(seat.Player, int(this.GameId), this.robotNum > 0)
seat.playerPool = int(this.PlayerPoolOdds(seat.Player)) seat.playerPool = int(this.PlayerPoolOdds(seat.Player))
if seat.odds > 0 { if seat.odds > 0 {
realPlayersGood = append(realPlayersGood, seat) realPlayersGood = append(realPlayersGood, seat)

View File

@ -1258,9 +1258,9 @@ func (this *StateBilled) OnEnter(s *base.Scene) {
if sceneEx.gamePlayerNum-sceneEx.robotNum > 0 { if sceneEx.gamePlayerNum-sceneEx.robotNum > 0 {
/////////////////////////////////////统计牌局详细记录 /////////////////////////////////////统计牌局详细记录
thirteenWaterType := model.ThirteenWaterType{ thirteenWaterType := model.ThirteenWaterType{
RoomId: int32(sceneEx.SceneId), RoomId: sceneEx.SceneId,
RoomRounds: int32(sceneEx.NumOfGames), RoomRounds: int32(sceneEx.NumOfGames),
RoomType: int32(sceneEx.SceneType), RoomType: sceneEx.GetSceneType(),
BaseScore: int32(sceneEx.GetBaseScore()), BaseScore: int32(sceneEx.GetBaseScore()),
NowRound: int32(sceneEx.NumOfGames), NowRound: int32(sceneEx.NumOfGames),
ClubRate: sceneEx.Scene.PumpCoin, ClubRate: sceneEx.Scene.PumpCoin,
@ -1462,7 +1462,7 @@ func (this *StateBilled) OnLeave(s *base.Scene) {
s.TryDismissRob() s.TryDismissRob()
} }
if s.CheckNeedDestroy() || (s.IsMatchScene() && (!s.MatchFinals || (s.MatchFinals && s.NumOfGames >= 2))) { // 非决赛打一场 决赛打两场 if s.CheckNeedDestroy() || (s.IsMatchScene() && (!s.GetMatch().GetIsFinals() || (s.GetMatch().GetIsFinals() && s.NumOfGames >= 2))) { // 非决赛打一场 决赛打两场
sceneEx.SceneDestroy(true) sceneEx.SceneDestroy(true)
} }
s.TryRelease() s.TryRelease()

View File

@ -386,7 +386,7 @@ func (this *TienLenSceneData) BroadcastOpPos() {
for _, seat := range this.seats { for _, seat := range this.seats {
if seat != nil && seat.IsGameing() { if seat != nil && seat.IsGameing() {
if !seat.IsRob { if !seat.IsRob {
seat.odds = this.GetPlayerOdds(seat.Player, this.GameId, this.robotGamingNum > 0) seat.odds = this.GetPlayerOdds(seat.Player, int(this.GameId), this.robotGamingNum > 0)
if seat.odds < 0 { if seat.odds < 0 {
B -= seat.odds B -= seat.odds
} }
@ -538,7 +538,7 @@ func (this *TienLenSceneData) IsTienLenToEnd() bool {
return common.IsTienLenToEnd(this.GetGameId()) return common.IsTienLenToEnd(this.GetGameId())
} }
func (this *TienLenSceneData) GetFreeGameSceneType() int32 { func (this *TienLenSceneData) GetFreeGameSceneType() int32 {
return int32(this.SceneType) return this.GetSceneType()
} }
// 比赛场发牌 // 比赛场发牌
@ -1076,7 +1076,7 @@ func (this *TienLenSceneData) SendHandCardOdds() {
if seat.IsRob { if seat.IsRob {
robotPlayers = append(robotPlayers, seat) robotPlayers = append(robotPlayers, seat)
} else { } else {
seat.odds = this.GetPlayerOdds(seat.Player, this.GameId, this.robotGamingNum > 0) seat.odds = this.GetPlayerOdds(seat.Player, int(this.GameId), this.robotGamingNum > 0)
seat.playerPool = int(this.PlayerPoolOdds(seat.Player)) seat.playerPool = int(this.PlayerPoolOdds(seat.Player))
if seat.odds > 0 { if seat.odds > 0 {
realPlayersGood = append(realPlayersGood, seat) realPlayersGood = append(realPlayersGood, seat)
@ -1087,7 +1087,7 @@ func (this *TienLenSceneData) SendHandCardOdds() {
} else { } else {
realPlayers = append(realPlayers, seat) realPlayers = append(realPlayers, seat)
} }
_, isNovice := seat.NoviceOdds(this.GameId) _, isNovice := seat.NoviceOdds(int(this.GameId))
if isNovice { if isNovice {
novicePlayers = append(novicePlayers, seat) novicePlayers = append(novicePlayers, seat)
} else { } else {
@ -1967,7 +1967,7 @@ func (this *TienLenSceneData) TrySmallGameBilled() {
logger.Logger.Trace("宠物技能抵挡炸弹生效,发送消息 SCTienLenPetSkillRes: ", pack) logger.Logger.Trace("宠物技能抵挡炸弹生效,发送消息 SCTienLenPetSkillRes: ", pack)
} }
if score != 0 { if score != 0 {
taxRate := this.DbGameFree.GetTaxRate() //万分比 taxRate := this.GetDBGameFree().GetTaxRate() //万分比
gainScore := int64(float64(score) * float64(10000-taxRate) / 10000.0) //税后 gainScore := int64(float64(score) * float64(10000-taxRate) / 10000.0) //税后
bombTaxScore := score - gainScore bombTaxScore := score - gainScore
// win // win

View File

@ -423,7 +423,7 @@ func TienLenCreateRoomInfoPacket(s *base.Scene, p *base.Player, sceneEx *TienLen
State: proto.Int32(int32(s.GetSceneState().GetState())), State: proto.Int32(int32(s.GetSceneState().GetState())),
TimeOut: proto.Int(s.GetSceneState().GetTimeout(s)), TimeOut: proto.Int(s.GetSceneState().GetTimeout(s)),
NumOfGames: proto.Int(sceneEx.NumOfGames), NumOfGames: proto.Int(sceneEx.NumOfGames),
TotalOfGames: proto.Int(sceneEx.TotalOfGames), TotalOfGames: sceneEx.TotalOfGames,
CurOpIdx: proto.Int(-1), CurOpIdx: proto.Int(-1),
MasterSnid: proto.Int32(sceneEx.masterSnid), MasterSnid: proto.Int32(sceneEx.masterSnid),
AudienceNum: proto.Int(s.GetAudiencesNum()), AudienceNum: proto.Int(s.GetAudiencesNum()),
@ -432,18 +432,26 @@ func TienLenCreateRoomInfoPacket(s *base.Scene, p *base.Player, sceneEx *TienLen
RankType: s.GetDBGameFree().GetRankType(), RankType: s.GetDBGameFree().GetRankType(),
SceneAdd: s.GetDBGameFree().GetSceneAdd(), SceneAdd: s.GetDBGameFree().GetSceneAdd(),
// 比赛场相关 // 比赛场相关
Round: int32(s.MatchRound), Round: s.GetMatch().GetCurrRound(),
CurPlayerNum: int32(s.MatchCurPlayerNum), CurPlayerNum: s.GetMatch().GetCurrPlayerNum(),
NextNeed: int32(s.MatchNextNeed), NextNeed: s.GetMatch().GetNextPlayerNum(),
RecordId: sceneEx.recordId, RecordId: sceneEx.recordId,
RoomTypeId: s.GetCustom().GetRoomTypeId(),
RoomConfigId: s.GetCustom().GetRoomConfigId(),
CostType: s.GetCustom().GetCostType(),
Voice: s.GetCustom().GetVoice(),
Password: s.GetCustom().GetPassword(),
}
if s.GetCustom().GetPassword() != "" {
pack.NeedPassword = 1
} }
pack.IsMatch = int32(0) pack.IsMatch = int32(0)
// 0.普通场 1.锦标赛 2.冠军赛 3.vip专属 // 0.普通场 1.锦标赛 2.冠军赛 3.vip专属
if s.IsMatchScene() { if s.IsMatchScene() {
pack.IsMatch = int32(s.MatchType) pack.IsMatch = s.GetMatch().GetMatchType()
} }
pack.MatchFinals = 0 pack.MatchFinals = 0
if s.MatchFinals { if s.GetMatch().GetIsFinals() {
pack.MatchFinals = 1 pack.MatchFinals = 1
if s.NumOfGames >= 2 { if s.NumOfGames >= 2 {
pack.MatchFinals = 2 pack.MatchFinals = 2
@ -879,7 +887,7 @@ func (this *SceneWaitStartStateTienLen) OnTick(s *base.Scene) {
if sceneEx, ok := s.GetExtraData().(*TienLenSceneData); ok { if sceneEx, ok := s.GetExtraData().(*TienLenSceneData); ok {
if sceneEx.IsMatchScene() { if sceneEx.IsMatchScene() {
delayT := time.Second * 2 delayT := time.Second * 2
if sceneEx.MatchRound != 1 { //第一轮延迟2s其他延迟3s 配合客户端播放动画 if sceneEx.GetMatch().GetCurrRound() != 1 { //第一轮延迟2s其他延迟3s 配合客户端播放动画
delayT = time.Second * 4 delayT = time.Second * 4
} }
if time.Now().Sub(sceneEx.StateStartTime) > delayT { if time.Now().Sub(sceneEx.StateStartTime) > delayT {
@ -985,7 +993,7 @@ func (this *SceneHandCardStateTienLen) OnEnter(s *base.Scene) {
seat.tianHu = rule.TianHu12Straight seat.tianHu = rule.TianHu12Straight
} }
if seat.tianHu > 0 { if seat.tianHu > 0 {
keyNovice := common.GetKeyNoviceGameId(sceneEx.GameId) keyNovice := common.GetKeyNoviceGameId(int(sceneEx.GameId))
data, ok := seat.GDatas[keyNovice] data, ok := seat.GDatas[keyNovice]
if !ok { if !ok {
data = &model.PlayerGameInfo{FirstTime: time.Now()} data = &model.PlayerGameInfo{FirstTime: time.Now()}
@ -1640,14 +1648,14 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
winRankScore := int64(0) winRankScore := int64(0)
pack := &tienlen.SCTienLenGameBilled{} pack := &tienlen.SCTienLenGameBilled{}
tienlenType := model.TienLenType{ tienlenType := model.TienLenType{
GameId: sceneEx.GameId, GameId: int(sceneEx.GameId),
RoomId: int32(sceneEx.GetSceneId()), RoomId: int32(sceneEx.GetSceneId()),
RoomType: sceneEx.GetFreeGameSceneType(), RoomType: sceneEx.GetFreeGameSceneType(),
NumOfGames: int32(sceneEx.Scene.NumOfGames), NumOfGames: int32(sceneEx.Scene.NumOfGames),
BankId: sceneEx.masterSnid, BankId: sceneEx.masterSnid,
PlayerCount: sceneEx.curGamingPlayerNum, PlayerCount: sceneEx.curGamingPlayerNum,
BaseScore: s.GetBaseScore(), BaseScore: s.GetBaseScore(),
TaxRate: s.DbGameFree.GetTaxRate(), TaxRate: s.GetDBGameFree().GetTaxRate(),
RoomMode: s.GetSceneMode(), RoomMode: s.GetSceneMode(),
PlayerPool: make(map[int]int), PlayerPool: make(map[int]int),
} }
@ -2023,7 +2031,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
var otherScore int64 // 额外总加分 var otherScore int64 // 额外总加分
oldRankScore := playerEx.GetRankScore(sceneEx.GetDBGameFree().GetRankType()) oldRankScore := playerEx.GetRankScore(sceneEx.GetDBGameFree().GetRankType())
rankScore = loseRankScore rankScore = loseRankScore
taxRate := sceneEx.DbGameFree.GetTaxRate() //万分比 taxRate := sceneEx.GetDBGameFree().GetTaxRate() //万分比
gainScore := int64(float64(losePlayerScore) * float64(10000-taxRate) / 10000.0) //税后 gainScore := int64(float64(losePlayerScore) * float64(10000-taxRate) / 10000.0) //税后
gainTaxScore := losePlayerScore - gainScore // 税收 gainTaxScore := losePlayerScore - gainScore // 税收
if playerNum == 3 { if playerNum == 3 {
@ -2133,7 +2141,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
var otherScore int64 // 额外总加分 var otherScore int64 // 额外总加分
oldRankScore := playerEx.GetRankScore(sceneEx.GetDBGameFree().GetRankType()) oldRankScore := playerEx.GetRankScore(sceneEx.GetDBGameFree().GetRankType())
rankScore = lastWinPlayerRankScore rankScore = lastWinPlayerRankScore
taxRate := sceneEx.DbGameFree.GetTaxRate() //万分比 taxRate := sceneEx.GetDBGameFree().GetTaxRate() //万分比
gainScore := int64(float64(lastWinPlayerScore) * float64(10000-taxRate) / 10000.0) //税后 gainScore := int64(float64(lastWinPlayerScore) * float64(10000-taxRate) / 10000.0) //税后
gainTaxScore := lastWinPlayerScore - gainScore gainTaxScore := lastWinPlayerScore - gainScore
if sceneEx.IsMatchScene() || sceneEx.IsCustom() { if sceneEx.IsMatchScene() || sceneEx.IsCustom() {
@ -2414,7 +2422,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
var otherScore int64 // 额外总加分 var otherScore int64 // 额外总加分
playerEx := sceneEx.players[winSnid] playerEx := sceneEx.players[winSnid]
if playerEx != nil { if playerEx != nil {
taxRate := sceneEx.DbGameFree.GetTaxRate() //万分比 taxRate := sceneEx.GetDBGameFree().GetTaxRate() //万分比
gainScore := int64(float64(winScore) * float64(10000-taxRate) / 10000.0) //税后 gainScore := int64(float64(winScore) * float64(10000-taxRate) / 10000.0) //税后
gainTaxScore := winScore - gainScore gainTaxScore := winScore - gainScore
if sceneEx.IsMatchScene() || sceneEx.IsCustom() { if sceneEx.IsMatchScene() || sceneEx.IsCustom() {
@ -2550,7 +2558,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
} }
sceneEx.RoundEndTime = append(sceneEx.RoundEndTime, time.Now().Unix()) sceneEx.RoundEndTime = append(sceneEx.RoundEndTime, time.Now().Unix())
sceneEx.RoundLogId = append(sceneEx.RoundLogId, sceneEx.recordId) sceneEx.RoundLogId = append(sceneEx.RoundLogId, sceneEx.recordId)
if sceneEx.NumOfGames >= sceneEx.TotalOfGames { if sceneEx.NumOfGames >= int(sceneEx.TotalOfGames) {
sceneEx.BilledList = make(map[int32]*[]*BilledInfo) sceneEx.BilledList = make(map[int32]*[]*BilledInfo)
sceneEx.RoundEndTime = sceneEx.RoundEndTime[:0] sceneEx.RoundEndTime = sceneEx.RoundEndTime[:0]
sceneEx.RoundLogId = sceneEx.RoundLogId[:0] sceneEx.RoundLogId = sceneEx.RoundLogId[:0]
@ -2780,10 +2788,10 @@ func (this *SceneBilledStateTienLen) OnLeave(s *base.Scene) {
s.TryDismissRob() s.TryDismissRob()
} }
if s.CheckNeedDestroy() || (s.IsMatchScene() && (!s.MatchFinals || (s.MatchFinals && s.NumOfGames >= 2))) { // 非决赛打一场 决赛打两场 if s.CheckNeedDestroy() || (s.IsMatchScene() && (!s.GetMatch().GetIsFinals() || (s.GetMatch().GetIsFinals() && s.NumOfGames >= 2))) { // 非决赛打一场 决赛打两场
sceneEx.SceneDestroy(true) sceneEx.SceneDestroy(true)
} }
if s.TotalOfGames > 0 && s.NumOfGames >= s.TotalOfGames { if s.TotalOfGames > 0 && s.NumOfGames >= int(s.TotalOfGames) {
sceneEx.SceneDestroy(true) sceneEx.SceneDestroy(true)
} }
s.RankMatchDestroy() s.RankMatchDestroy()

File diff suppressed because it is too large Load Diff

View File

@ -167,32 +167,44 @@ message Item {
int64 Num = 2; int64 Num = 2;
} }
message CustomParam {
int32 RoomTypeId = 1; // id
int32 RoomConfigId = 2; // id
int32 CostType = 3; // 1 2AA
string Password = 4; //
int32 Voice = 5; // 1 2
}
message MatchParam {
int64 MatchSortId = 1; // id
int32 MatchId = 2; // id
bool IsFinals = 3; //
int32 CurrRound = 4; //
int32 CurrPlayerNum = 5; //
int32 NextPlayerNum = 6; //
int32 MatchType = 7; //
}
//PACKET_WG_CREATESCENE //PACKET_WG_CREATESCENE
message WGCreateScene { message WGCreateScene {
int32 SceneId = 1; string Platform = 1; //
int32 GameId = 2; int32 SceneId = 2; // id
int32 GameMode = 3; int32 GameId = 3; // id
repeated int64 Params = 4; int32 GameMode = 4; //
int32 Creator = 5; int32 SceneMode = 5; //
int32 Agentor = 6; string ReplayCode = 6; //
string ReplayCode = 7; DB_GameFree DBGameFree = 7; //
repeated int64 ParamsEx = 8; int32 TotalOfGames = 8; //
int32 SceneMode = 9; int32 PlayerNum = 9; //
int32 HallId = 10; bool EnterAfterStart = 10; //
string Platform = 11; int32 Creator = 11; // id
DB_GameFree DBGameFree = 12; int32 BaseScore = 12; //
int32 GroupId = 13; repeated Item Items = 13; //
bool EnterAfterStart = 14; repeated Item CostItems = 14; //
int32 TotalOfGames = 15; CustomParam Custom = 15; //
int32 Club = 16; //Id MatchParam Match = 16; //
string ClubRoomId = 17; repeated int32 ChessRank = 26; //
int32 ClubRoomPos = 18; repeated int64 Params = 27; // ,GameRule中定义,
int32 ClubRate = 19;
int32 BaseScore = 20;
int32 PlayerNum = 21;
bool RealCtrl = 22;
repeated int32 ChessRank = 23;
repeated Item Items = 24; //
} }
//PACKET_WG_DESTROYSCENE //PACKET_WG_DESTROYSCENE

View File

@ -98,9 +98,9 @@ func (this *CSEnterRoomHandler) Process(s *netlib.Session, packetid int, data in
} }
// 密码是否正确 // 密码是否正确
if scene.password != "" && scene.password != msg.GetPassword() { if scene.GetPassword() != "" && scene.GetPassword() != msg.GetPassword() {
code = gamehall.OpResultCode_Game_OPRC_PasswordError code = gamehall.OpResultCode_Game_OPRC_PasswordError
logger.Logger.Trace("CSEnterRoomHandler scene is closed") logger.Logger.Trace("CSEnterRoomHandler password error")
goto failed goto failed
} }
@ -153,9 +153,8 @@ func (this *CSEnterRoomHandler) Process(s *netlib.Session, packetid int, data in
} }
skinId := int32(300001) skinId := int32(300001)
var tm *TmMatch var tm *TmMatch
if len(scene.params) > 3 { if scene.MatchSortId > 0 {
sortId := scene.params[0] tm = TournamentMgr.GetTm(scene.MatchSortId)
tm = TournamentMgr.GetTm(sortId)
if tm != nil && tm.copyRobotGrades != nil && len(tm.copyRobotGrades) > 0 { if tm != nil && tm.copyRobotGrades != nil && len(tm.copyRobotGrades) > 0 {
randIndex := rand.Intn(len(tm.copyRobotGrades)) randIndex := rand.Intn(len(tm.copyRobotGrades))
grade = tm.copyRobotGrades[randIndex].grade grade = tm.copyRobotGrades[randIndex].grade
@ -1260,7 +1259,7 @@ func CSCreatePrivateRoomHandler(s *netlib.Session, packetId int, data interface{
return nil return nil
} }
// 游戏是否开启 // 游戏是否开启
if cfg.GetOn() != common.On || gf.GetStatus() { if cfg.GetOn() != common.On || !gf.GetStatus() {
code = gamehall.OpResultCode_Game_OPRC_GameHadClosed code = gamehall.OpResultCode_Game_OPRC_GameHadClosed
send() send()
return nil return nil
@ -1287,22 +1286,24 @@ func CSCreatePrivateRoomHandler(s *netlib.Session, packetId int, data interface{
csp := CoinSceneMgrSingleton.GetCoinScenePool(p.GetPlatform().IdStr, msg.GetGameFreeId()) csp := CoinSceneMgrSingleton.GetCoinScenePool(p.GetPlatform().IdStr, msg.GetGameFreeId())
roomId := SceneMgrSingleton.GenOnePrivateSceneId() roomId := SceneMgrSingleton.GenOnePrivateSceneId()
scene := SceneMgrSingleton.CreateScene(&CreateSceneParam{ scene := SceneMgrSingleton.CreateScene(&CreateSceneParam{
CreateId: p.SnId, CreateId: p.SnId,
RoomId: roomId, RoomId: roomId,
SceneMode: common.SceneMode_Private, SceneMode: common.SceneMode_Private,
CycleTimes: 0, CycleTimes: 0,
TotalRound: int(msg.GetRound()), TotalRound: int(msg.GetRound()),
Params: common.CopySliceInt32ToInt64(csp.dbGameRule.GetParams()), Params: common.CopySliceInt32ToInt64(csp.dbGameRule.GetParams()),
GS: nil, GS: nil,
Platform: PlatformMgrSingleton.GetPlatform(p.Platform), Platform: PlatformMgrSingleton.GetPlatform(p.Platform),
GF: csp.dbGameFree, GF: csp.dbGameFree,
PlayerNum: msg.GetPlayerNum(), PlayerNum: msg.GetPlayerNum(),
Password: password, Channel: cfg.GetOnChannelName(),
Voice: int32(voice), CustomParam: &server.CustomParam{
Channel: cfg.GetOnChannelName(), RoomTypeId: cfg.GetRoomType(),
RoomType: PlatformMgrSingleton.GetConfig(p.Platform).RoomType[cfg.GetRoomType()], RoomConfigId: cfg.GetId(),
RoomConfig: cfg, CostType: int32(costType),
RoomCostType: int(msg.GetCostType()), Password: password,
Voice: int32(voice),
},
}) })
if scene == nil { if scene == nil {
@ -1364,7 +1365,7 @@ func CSGetPrivateRoomListHandler(s *netlib.Session, packetId int, data interface
}) })
for _, v := range scenes { for _, v := range scenes {
needPassword := 0 needPassword := 0
if v.password != "" { if v.GetPassword() != "" {
needPassword = 1 needPassword = 1
} }
var players []*gamehall.PrivatePlayerInfo var players []*gamehall.PrivatePlayerInfo
@ -1378,8 +1379,8 @@ func CSGetPrivateRoomListHandler(s *netlib.Session, packetId int, data interface
d := &gamehall.PrivateRoomInfo{ d := &gamehall.PrivateRoomInfo{
GameFreeId: v.dbGameFree.GetId(), GameFreeId: v.dbGameFree.GetId(),
GameId: v.dbGameFree.GetGameId(), GameId: v.dbGameFree.GetGameId(),
RoomTypeId: v.RoomType.GetId(), RoomTypeId: v.GetRoomTypeId(),
RoomConfigId: v.RoomConfig.GetId(), RoomConfigId: v.GetRoomConfigId(),
RoomId: int32(v.sceneId), RoomId: int32(v.sceneId),
NeedPassword: int32(needPassword), NeedPassword: int32(needPassword),
CurrRound: v.currRound, CurrRound: v.currRound,

View File

@ -58,7 +58,7 @@ func init() {
case scene.IsMatchScene(): case scene.IsMatchScene():
if !MatchSceneMgrSingleton.PlayerLeave(p, int(msg.GetReason())) { if !MatchSceneMgrSingleton.PlayerLeave(p, int(msg.GetReason())) {
logger.Logger.Warnf("GWPlayerLeave snid:%v sceneid:%v gameid:%v modeid:%v matchid:%v [matchscene]", logger.Logger.Warnf("GWPlayerLeave snid:%v sceneid:%v gameid:%v modeid:%v matchid:%v [matchscene]",
p.SnId, scene.sceneId, scene.gameId, scene.gameMode, scene.matchId) p.SnId, scene.sceneId, scene.gameId, scene.gameMode, scene.MatchSortId)
} else { } else {
//结算积分 //结算积分
if !p.IsRob { if !p.IsRob {
@ -366,7 +366,7 @@ func init() {
case scene.IsMatchScene(): case scene.IsMatchScene():
if !MatchSceneMgrSingleton.PlayerLeave(p, int(msg.GetReason())) { if !MatchSceneMgrSingleton.PlayerLeave(p, int(msg.GetReason())) {
logger.Logger.Warnf("GWPlayerLeave snid:%v sceneid:%v gameid:%v modeid:%v matchid:%v [matchscene]", logger.Logger.Warnf("GWPlayerLeave snid:%v sceneid:%v gameid:%v modeid:%v matchid:%v [matchscene]",
p.SnId, scene.sceneId, scene.gameId, scene.gameMode, scene.matchId) p.SnId, scene.sceneId, scene.gameId, scene.gameMode, scene.MatchSortId)
} }
default: default:
scene.PlayerLeave(p, int(msg.GetReason())) scene.PlayerLeave(p, int(msg.GetReason()))
@ -538,7 +538,7 @@ func init() {
if scene != nil { if scene != nil {
scene.State = msg.GetState() scene.State = msg.GetState()
scene.StateSec = msg.GetSec() scene.StateSec = msg.GetSec()
scene.BankerListNum = msg.GetBankerListNum() //scene.BankerListNum = msg.GetBankerListNum()
if scene.State == scene.sp.GetBetState() { if scene.State == scene.sp.GetBetState() {
scene.StateTs = msg.GetTs() scene.StateTs = msg.GetTs()
leftTime := int64(scene.StateSec) - (time.Now().Unix() - scene.StateTs) leftTime := int64(scene.StateSec) - (time.Now().Unix() - scene.StateTs)

View File

@ -184,7 +184,7 @@ func CSRoomList(s *netlib.Session, packetId int, data interface{}, sid int64) er
audience := msg.GetTp() == 1 audience := msg.GetTp() == 1
scenes := TournamentMgr.GetTmRoom(p.Platform, 0, p.LastChannel, audience, msg.GetId()) scenes := TournamentMgr.GetTmRoom(p.Platform, 0, p.LastChannel, audience, msg.GetId())
for _, v := range scenes { for _, v := range scenes {
tm := TournamentMgr.GetTm(v.matchId) tm := TournamentMgr.GetTm(v.MatchSortId)
if tm == nil { if tm == nil {
continue continue
} }

View File

@ -151,45 +151,55 @@ func (this *GameSession) OnStateOff() {
this.Send(int(server_proto.SSPacketID_PACKET_WG_SERVER_STATE), pack) this.Send(int(server_proto.SSPacketID_PACKET_WG_SERVER_STATE), pack)
} }
func (this *GameSession) AddScene(s *Scene) { type AddSceneParam struct {
this.scenes[s.sceneId] = s S *Scene
}
func (this *GameSession) AddScene(args *AddSceneParam) {
this.scenes[args.S.sceneId] = args.S
//send msg //send msg
msg := &server_proto.WGCreateScene{ msg := &server_proto.WGCreateScene{
SceneId: proto.Int(s.sceneId), Platform: args.S.limitPlatform.IdStr,
GameId: proto.Int(s.gameId), SceneId: int32(args.S.sceneId),
GameMode: proto.Int(s.gameMode), GameId: int32(args.S.gameId),
SceneMode: proto.Int(s.sceneMode), GameMode: int32(args.S.gameMode),
Params: s.params, SceneMode: int32(args.S.sceneMode),
Creator: proto.Int32(s.creator), ReplayCode: args.S.replayCode,
HallId: proto.Int32(s.hallId), DBGameFree: args.S.dbGameFree,
ReplayCode: proto.String(s.replayCode), TotalOfGames: args.S.totalRound,
GroupId: proto.Int32(s.groupId), PlayerNum: int32(args.S.playerNum),
TotalOfGames: proto.Int32(s.totalRound), Creator: args.S.creator,
BaseScore: proto.Int32(s.BaseScore), BaseScore: args.S.BaseScore,
PlayerNum: proto.Int(s.playerNum), Custom: args.S.CustomParam,
DBGameFree: s.dbGameFree, Match: args.S.MatchParam,
Platform: s.limitPlatform.IdStr, Params: args.S.params,
} }
if s.RoomConfig != nil { if args.S.GetRoomTypeId() != 0 {
for _, v := range s.RoomConfig.GetCost() { cfg := PlatformMgrSingleton.GetConfig(args.S.limitPlatform.IdStr).RoomConfig[args.S.GetRoomTypeId()]
msg.Items = append(msg.Items, &server_proto.Item{ if cfg != nil {
Id: v.GetItemId(), for _, v := range cfg.GetReward() {
Num: v.GetItemNum(), msg.Items = append(msg.Items, &server_proto.Item{
}) Id: v.GetItemId(),
Num: v.GetItemNum(),
})
}
for _, v := range cfg.GetCost() {
msg.CostItems = append(msg.CostItems, &server_proto.Item{
Id: v.GetItemId(),
Num: v.GetItemNum(),
})
}
} }
} }
if s.IsCoinScene() { if sp, ok := args.S.sp.(*ScenePolicyData); ok {
if sp, ok := s.sp.(*ScenePolicyData); ok { msg.EnterAfterStart = proto.Bool(sp.EnterAfterStart)
msg.EnterAfterStart = proto.Bool(sp.EnterAfterStart)
}
} }
// 象棋游戏添加段位配置 // 象棋游戏添加段位配置
if s.dbGameFree != nil && s.dbGameFree.GameDif == common.GameDifChess { if args.S.dbGameFree != nil && srvdata.GameFreeMgr.IsGameDif(int32(args.S.gameId), common.GameDifChess) {
msg.ChessRank = ChessRankMgrSington.GetChessRankArr(s.limitPlatform.Name, int32(s.gameId)) msg.ChessRank = ChessRankMgrSington.GetChessRankArr(args.S.limitPlatform.Name, int32(args.S.gameId))
} }
proto.SetDefaults(msg)
this.Send(int(server_proto.SSPacketID_PACKET_WG_CREATESCENE), msg) this.Send(int(server_proto.SSPacketID_PACKET_WG_CREATESCENE), msg)
logger.Logger.Trace("WGCreateScene:", msg) logger.Logger.Tracef("WGCreateScene: %v", msg)
} }
func (this *GameSession) DelScene(s *Scene) { func (this *GameSession) DelScene(s *Scene) {

View File

@ -1,6 +1,7 @@
package main package main
import ( import (
"mongo.games.com/game/srvdata"
"mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/logger"
"mongo.games.com/game/common" "mongo.games.com/game/common"
@ -46,18 +47,24 @@ func (ms *MatchSceneMgr) NewScene(tm *TmMatch, isFinals bool, round int32) *Scen
nextNeed = tm.gmd.MatchPromotion[round] nextNeed = tm.gmd.MatchPromotion[round]
} }
} }
// 建房参数 rule := srvdata.PBDB_GameRuleMgr.GetData(tm.dbGameFree.GetGameRule())
// 比赛唯一索引,是否决赛,第几轮,本轮总人数,下一轮总人数,赛制类型
params := []int64{tm.SortId, int64(finals), int64(round), int64(curPlayerNum), int64(nextNeed), int64(tm.gmd.MatchType)}
scene := SceneMgrSingleton.CreateScene(&CreateSceneParam{ scene := SceneMgrSingleton.CreateScene(&CreateSceneParam{
RoomId: sceneId, RoomId: sceneId,
SceneMode: common.SceneMode_Match, SceneMode: common.SceneMode_Match,
Params: params, Params: common.CopySliceInt32ToInt64(rule.GetParams()),
Platform: limitPlatform, Platform: limitPlatform,
GF: tm.dbGameFree, GF: tm.dbGameFree,
MatchParam: &server.MatchParam{
MatchId: tm.TMId,
MatchSortId: tm.SortId,
IsFinals: finals == 1,
CurrRound: round,
CurrPlayerNum: curPlayerNum,
NextPlayerNum: nextNeed,
MatchType: tm.gmd.MatchType,
},
}) })
if scene != nil { if scene != nil {
scene.matchId = tm.SortId
return scene return scene
} }
return nil return nil
@ -153,7 +160,7 @@ func (ms *MatchSceneMgr) PlayerLeave(p *Player, reason int) bool {
if p == nil || p.scene == nil { if p == nil || p.scene == nil {
return true return true
} }
if p.scene.matchId == 0 { if p.scene.MatchSortId == 0 {
return true return true
} }
p.scene.PlayerLeave(p, reason) p.scene.PlayerLeave(p, reason)
@ -182,7 +189,7 @@ func (ms *MatchSceneMgr) AudienceEnter(p *Player, id int32, roomId int, exclude
func (ms *MatchSceneMgr) MatchStop(tm *TmMatch) { func (ms *MatchSceneMgr) MatchStop(tm *TmMatch) {
if SceneMgrSingleton.scenes != nil && tm != nil { if SceneMgrSingleton.scenes != nil && tm != nil {
for _, scene := range SceneMgrSingleton.scenes { for _, scene := range SceneMgrSingleton.scenes {
if scene.IsMatchScene() && scene.matchId == tm.SortId { if scene.IsMatchScene() && scene.MatchSortId == tm.SortId {
scene.SendGameDestroy(false) scene.SendGameDestroy(false)
} }
} }

View File

@ -18,7 +18,6 @@ import (
"mongo.games.com/game/proto" "mongo.games.com/game/proto"
hallproto "mongo.games.com/game/protocol/gamehall" hallproto "mongo.games.com/game/protocol/gamehall"
serverproto "mongo.games.com/game/protocol/server" serverproto "mongo.games.com/game/protocol/server"
webapiproto "mongo.games.com/game/protocol/webapi"
"mongo.games.com/game/srvdata" "mongo.games.com/game/srvdata"
) )
@ -39,73 +38,51 @@ type PlayerGameCtx struct {
totalConvertibleFlow int64 //进房时玩家身上的总流水 totalConvertibleFlow int64 //进房时玩家身上的总流水
} }
// MatchParams 比赛场配置
type MatchParams struct {
MatchId int64 // 比赛场id
}
// CustomParams 房卡场配置
type CustomParams struct {
RoomType *webapiproto.RoomType // 房卡场房间类型id
RoomConfig *webapiproto.RoomConfig // 房卡场房间配置id
RoomCostType int // 房卡收费方式
}
// Scene 场景(房间) // Scene 场景(房间)
// todo 结构优化 // todo 结构优化
type Scene struct { type Scene struct {
sceneId int // 场景id sceneId int // 场景id
gameId int // 游戏id gameId int // 游戏id
gameMode int // 游戏模式(玩法) gameMode int // 游戏模式(玩法)
sceneMode int // 房间模式,参考common.SceneMode_XXX sceneMode int // 房间模式,参考common.SceneMode_XXX
params []int64 // 场景参数 params []int64 // 场景参数
playerNum int // 房间最大人数 playerNum int // 房间最大人数
robotNum int // 机器人数量 robotNum int // 机器人数量
robotLimit int // 最大限制机器人数量 robotLimit int // 最大限制机器人数量
preInviteRobNum int // 准备邀请机器人的数量 preInviteRobNum int // 准备邀请机器人的数量
creator int32 // 创建者账号id creator int32 // 创建者账号id
replayCode string // 回放码 replayCode string // 回放码
currRound int32 // 当前第几轮 currRound int32 // 当前第几轮
totalRound int32 // 总共几轮小于等于0表示无限轮 totalRound int32 // 总共几轮小于等于0表示无限轮
cycleTimes int32 // 循环次数 cycleTimes int32 // 循环次数
deleting bool // 正在删除 deleting bool // 正在删除
starting bool // 正在开始 starting bool // 正在开始
closed bool // 房间已关闭 closed bool // 房间已关闭
force bool // 强制删除 force bool // 强制删除
players map[int32]*Player // 玩家 players map[int32]*Player // 玩家
audiences map[int32]*Player // 观众 audiences map[int32]*Player // 观众
seats [9]*Player // 座位 seats [9]*Player // 座位
gameSess *GameSession // 所在gameserver gameSess *GameSession // 所在gameserver
sp ScenePolicy // 场景上的一些业务策略 sp ScenePolicy // 场景上的一些业务策略
createTime time.Time // 创建时间 createTime time.Time // 创建时间
lastTime time.Time // 最后活跃时间 lastTime time.Time // 最后活跃时间
startTime time.Time // 开始时间 startTime time.Time // 开始时间
applyTimes map[int32]int32 // 申请坐下次数 applyTimes map[int32]int32 // 申请坐下次数
limitPlatform *Platform // 限制平台 limitPlatform *Platform // 限制平台
groupId int32 // 组id groupId int32 // 组id
hallId int32 // 厅id hallId int32 // 厅id
dbGameFree *serverproto.DB_GameFree // 场次配置 dbGameFree *serverproto.DB_GameFree // 场次配置
gameCtx map[int32]*PlayerGameCtx // 进入房间的环境 gameCtx map[int32]*PlayerGameCtx // 进入房间的环境
BaseScore int32 // 游戏底分,优先级,创建参数>本地配置>场次配置 BaseScore int32 // 游戏底分,优先级,创建参数>本地配置>场次配置
SceneState int32 // 房间当前状态 SceneState int32 // 房间当前状态
State int32 // 当前游戏状态后期放到ScenePolicy里去处理 State int32 // 当前游戏状态后期放到ScenePolicy里去处理
StateTs int64 // 切换到当前状态的时间 StateTs int64 // 切换到当前状态的时间
StateSec int32 // 押注状态的秒数 StateSec int32 // 押注状态的秒数
password string // 密码 Channel []string // 客户端类型
channel []string // 渠道,房卡场有渠道限制 *serverproto.CustomParam // 房卡场参数
voice int32 // 是否开启语音 1开启 *serverproto.MatchParam // 比赛场参数
csp *CoinScenePool // 所在场景池
matchId int64 // 比赛场id hp *HundredSceneMgr // 百人场房间池
fishing int32 // 渔场的鱼潮状态
GameLog []int32 // 游戏服务器同步的录单
BankerListNum int32 // 庄家列表数量
matchParams []int32 // 比赛参数
matchState int // 比赛状态
CustomParams // 房卡场参数
csp *CoinScenePool // 所在场景池
hp *HundredSceneMgr // 百人场房间池
} }
// NewScene 创建房间 // NewScene 创建房间
@ -141,15 +118,10 @@ func NewScene(args *CreateSceneParam) *Scene {
dbGameFree: args.GF, dbGameFree: args.GF,
currRound: 0, currRound: 0,
totalRound: int32(args.TotalRound), totalRound: int32(args.TotalRound),
password: args.Password,
voice: args.Voice,
channel: args.Channel,
BaseScore: args.BaseScore, BaseScore: args.BaseScore,
CustomParams: CustomParams{ Channel: args.Channel,
RoomType: args.RoomType, CustomParam: args.CustomParam,
RoomConfig: args.RoomConfig, MatchParam: args.MatchParam,
RoomCostType: args.RoomCostType,
},
} }
// 最大房间人数 // 最大房间人数
if s.playerNum <= 0 { if s.playerNum <= 0 {
@ -165,9 +137,6 @@ func NewScene(args *CreateSceneParam) *Scene {
if s.cycleTimes <= 0 { if s.cycleTimes <= 0 {
s.cycleTimes = 1 s.cycleTimes = 1
} }
if s.totalRound <= 0 {
s.totalRound = 1
}
s.lastTime = s.createTime s.lastTime = s.createTime
s.replayCode = SceneMgrSingleton.AllocReplayCode() s.replayCode = SceneMgrSingleton.AllocReplayCode()
@ -837,15 +806,15 @@ func (this *Scene) GetSceneName() string {
func (this *Scene) RandRobotCnt() { func (this *Scene) RandRobotCnt() {
if this.dbGameFree != nil { if this.dbGameFree != nil {
numrng := this.dbGameFree.GetRobotNumRng() number := this.dbGameFree.GetRobotNumRng()
if len(numrng) >= 2 { if len(number) >= 2 {
if numrng[1] == numrng[0] { if number[1] == number[0] {
this.robotLimit = int(numrng[0]) this.robotLimit = int(number[0])
} else { } else {
if numrng[1] < numrng[0] { if number[1] < number[0] {
numrng[1], numrng[0] = numrng[0], numrng[1] number[1], number[0] = number[0], number[1]
} }
this.robotLimit = int(numrng[1]) //int(numrng[0] + rand.Int31n(numrng[1]-numrng[0]) + 1) this.robotLimit = int(number[1]) //int(number[0] + rand.Int31n(number[1]-number[0]) + 1)
} }
} }
return return
@ -973,10 +942,10 @@ func (this *Scene) TryForceDeleteMatchInfo() {
if len(this.players) == 0 { if len(this.players) == 0 {
return return
} }
if this.matchId == 0 { if this.MatchSortId == 0 {
return return
} }
if players, exist := TournamentMgr.players[this.matchId]; exist { if players, exist := TournamentMgr.players[this.MatchSortId]; exist {
for _, player := range this.players { for _, player := range this.players {
if player != nil && !player.IsRob { if player != nil && !player.IsRob {
if TournamentMgr.IsMatching(player.SnId) { if TournamentMgr.IsMatching(player.SnId) {
@ -990,8 +959,8 @@ func (this *Scene) TryForceDeleteMatchInfo() {
// CanAudience 是否允许观战 // CanAudience 是否允许观战
func (this *Scene) CanAudience() bool { func (this *Scene) CanAudience() bool {
switch { switch {
case this.matchId > 0: // 比赛场 case this.GetMatchSortId() > 0: // 比赛场
tm := TournamentMgr.GetTm(this.matchId) tm := TournamentMgr.GetTm(this.GetMatchSortId())
if tm != nil { if tm != nil {
return tm.gmd.GetAudienceSwitch() == 1 return tm.gmd.GetAudienceSwitch() == 1
} }

View File

@ -155,7 +155,7 @@ func (m *SceneMgr) GetScenesByGameFreeId(gameFreeId int32) []*Scene {
func (m *SceneMgr) GetMatchRoom(sortId int64) []*Scene { func (m *SceneMgr) GetMatchRoom(sortId int64) []*Scene {
var scenes []*Scene var scenes []*Scene
for _, value := range m.scenes { for _, value := range m.scenes {
if value.matchId == sortId { if value.MatchSortId == sortId {
s := m.GetScene(value.sceneId) s := m.GetScene(value.sceneId)
if s != nil { if s != nil {
scenes = append(scenes, value) scenes = append(scenes, value)
@ -223,7 +223,7 @@ func (m *SceneMgr) MarshalAllRoom(platform string, groupId, gameId int, gameMode
isContinue := false isContinue := false
if snId != 0 { if snId != 0 {
for _, p := range s.players { for _, p := range s.players {
if p.SnId == int32(snId) { if p.SnId == snId {
isContinue = true isContinue = true
break break
} }
@ -347,7 +347,7 @@ func (m *SceneMgr) FindRoomList(args *FindRoomParam) []*Scene {
if len(args.Channel) > 0 { if len(args.Channel) > 0 {
has := false has := false
for _, vv := range args.Channel { for _, vv := range args.Channel {
if slices.Contains(v.channel, vv) { if slices.Contains(v.Channel, vv) {
has = true has = true
break break
} }
@ -367,23 +367,20 @@ func (m *SceneMgr) FindRoomList(args *FindRoomParam) []*Scene {
} }
type CreateSceneParam struct { type CreateSceneParam struct {
CreateId int32 // 创建者id CreateId int32 // 创建者id
RoomId int // 房间id RoomId int // 房间id
SceneMode int // 公共,私人,赛事 SceneMode int // 公共,私人,赛事
CycleTimes int // 循环次数 CycleTimes int // 循环次数
TotalRound int // 总轮数 TotalRound int // 总轮数
Params []int64 // 房间参数 Params []int64 // 房间参数
GS *GameSession GS *GameSession // 游戏服务
Platform *Platform Platform *Platform // 所在平台
GF *serverproto.DB_GameFree GF *serverproto.DB_GameFree // 场次配置
PlayerNum int32 // 玩家最大数量 PlayerNum int32 // 玩家最大数量
Password string BaseScore int32 // 底分
Voice int32 // 1开启 Channel []string // 客户端类型,允许查看的客户端类型
Channel []string *serverproto.CustomParam // 房卡场参数
RoomType *webapiproto.RoomType *serverproto.MatchParam // 比赛场参数
RoomConfig *webapiproto.RoomConfig
BaseScore int32
RoomCostType int
} }
// CreateScene 创建房间 // CreateScene 创建房间
@ -409,7 +406,9 @@ func (m *SceneMgr) CreateScene(args *CreateSceneParam) *Scene {
} }
m.scenes[args.RoomId] = s m.scenes[args.RoomId] = s
// 添加到游戏服记录中 // 添加到游戏服记录中
args.GS.AddScene(s) args.GS.AddScene(&AddSceneParam{
S: s,
})
logger.Logger.Infof("SceneMgr NewScene Platform:%v %+v", args.Platform.IdStr, args) logger.Logger.Infof("SceneMgr NewScene Platform:%v %+v", args.Platform.IdStr, args)
// 创建水池 // 创建水池
@ -443,7 +442,7 @@ func (m *SceneMgr) DestroyScene(sceneId int, isCompleted bool) {
s.gameSess.DelScene(s) s.gameSess.DelScene(s)
s.OnClose() s.OnClose()
delete(m.scenes, s.sceneId) delete(m.scenes, s.sceneId)
delete(m.password, s.password) delete(m.password, s.GetPassword())
logger.Logger.Infof("(this *SceneMgr) DestroyScene, SceneId=%v", sceneId) logger.Logger.Infof("(this *SceneMgr) DestroyScene, SceneId=%v", sceneId)
} }

View File

@ -117,11 +117,18 @@ func (spd *ScenePolicyData) costEnough(costType, playerNum int, roomConfig *weba
} }
func (spd *ScenePolicyData) CostEnough(costType, playerNum int, roomConfig *webapi.RoomConfig, p *Player) bool { func (spd *ScenePolicyData) CostEnough(costType, playerNum int, roomConfig *webapi.RoomConfig, p *Player) bool {
if roomConfig == nil {
return false
}
return spd.costEnough(costType, playerNum, roomConfig, p, func(items []*model.Item) {}) return spd.costEnough(costType, playerNum, roomConfig, p, func(items []*model.Item) {})
} }
func (spd *ScenePolicyData) CostPayment(s *Scene, p *Player) bool { func (spd *ScenePolicyData) CostPayment(s *Scene, p *Player) bool {
return spd.costEnough(s.RoomCostType, s.playerNum, s.RoomConfig, p, func(items []*model.Item) { roomConfig := PlatformMgrSingleton.GetConfig(p.Platform).RoomConfig[s.GetRoomConfigId()]
if roomConfig == nil {
return false
}
return spd.costEnough(int(roomConfig.GetCostType()), s.playerNum, roomConfig, p, func(items []*model.Item) {
BagMgrSingleton.AddItemsV2(&model.AddItemParam{ BagMgrSingleton.AddItemsV2(&model.AddItemParam{
P: p.PlayerData, P: p.PlayerData,
Change: items, Change: items,
@ -130,7 +137,7 @@ func (spd *ScenePolicyData) CostPayment(s *Scene, p *Player) bool {
Remark: "竞技馆进房费用", Remark: "竞技馆进房费用",
GameId: int64(s.gameId), GameId: int64(s.gameId),
GameFreeId: int64(s.dbGameFree.GetId()), GameFreeId: int64(s.dbGameFree.GetId()),
RoomConfigId: s.RoomConfig.GetId(), RoomConfigId: roomConfig.GetId(),
}) })
}) })
} }