创建房间参数优化
This commit is contained in:
parent
cae5536ed3
commit
bfdf500eec
|
@ -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)
|
||||
pack := &gamehall.SCLeaveRoom{
|
||||
OpRetCode: gamehall.OpResultCode_Game_OPRC_YourAreGamingCannotLeave_Game,
|
||||
RoomId: proto.Int(scene.SceneId),
|
||||
RoomId: scene.SceneId,
|
||||
}
|
||||
proto.SetDefaults(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),
|
||||
OpRetCode: gamehall.OpResultCode_Game_OPRC_Sucess_Game,
|
||||
Mode: msg.Mode,
|
||||
RoomId: proto.Int(scene.SceneId),
|
||||
RoomId: scene.SceneId,
|
||||
}
|
||||
proto.SetDefaults(pack)
|
||||
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_LEAVEROOM), pack)
|
||||
|
|
|
@ -73,64 +73,22 @@ func HandleWGPlayerLeave(session *netlib.Session, packetId int, data interface{}
|
|||
// return nil
|
||||
//}
|
||||
|
||||
func init() {
|
||||
//创建场景
|
||||
netlib.RegisterFactory(int(server.SSPacketID_PACKET_WG_CREATESCENE), netlib.PacketFactoryWrapper(func() interface{} {
|
||||
return &server.WGCreateScene{}
|
||||
}))
|
||||
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
|
||||
}
|
||||
}
|
||||
func CreateSceneHandler(session *netlib.Session, packetId int, data interface{}) error {
|
||||
logger.Logger.Tracef("receive CreateScene %v", data)
|
||||
msg, ok := data.(*server.WGCreateScene)
|
||||
if !ok {
|
||||
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 {
|
||||
p.Coin = int64(scene.DbGameFree.GetTestTakeCoin())
|
||||
p.Coin = int64(scene.GetDBGameFree().GetTestTakeCoin())
|
||||
}
|
||||
base.PlayerMgrSington.ManagePlayer(p)
|
||||
scene.PlayerEnter(p, isload)
|
||||
|
@ -397,7 +355,7 @@ func init() {
|
|||
//p.coin = msg.GetTakeCoin()
|
||||
//p.takeCoin = msg.GetTakeCoin()
|
||||
if scene.Testing {
|
||||
p.Coin = int64(scene.DbGameFree.GetTestTakeCoin())
|
||||
p.Coin = int64(scene.GetDBGameFree().GetTestTakeCoin())
|
||||
}
|
||||
p.LastSyncCoin = p.Coin
|
||||
scene.AudienceSit(p)
|
||||
|
|
|
@ -57,14 +57,14 @@ func (this *AvengersSceneData) SceneDestroy(force bool) {
|
|||
}
|
||||
|
||||
func (this *AvengersSceneData) init() bool {
|
||||
if this.DbGameFree == nil {
|
||||
if this.GetDBGameFree() == nil {
|
||||
return false
|
||||
}
|
||||
params := this.DbGameFree.GetJackpot()
|
||||
params := this.GetDBGameFree().GetJackpot()
|
||||
this.jackpot = &base.SlotJackpotPool{}
|
||||
if 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)
|
||||
if str != "" {
|
||||
|
@ -100,7 +100,7 @@ type AvengersSpinResult struct {
|
|||
}
|
||||
|
||||
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 {
|
||||
newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0)
|
||||
if taxScore != nil {
|
||||
|
@ -188,7 +188,7 @@ func (this *AvengersSceneData) BroadcastJackpot(sync bool) {
|
|||
this.lastJackpotValue = this.jackpot.VirtualJK
|
||||
pack := &gamehall.SCHundredSceneGetGameJackpot{}
|
||||
jpfi := &gamehall.GameJackpotFundInfo{
|
||||
GameFreeId: proto.Int32(this.DbGameFree.Id),
|
||||
GameFreeId: proto.Int32(this.GetDBGameFree().Id),
|
||||
JackPotFund: proto.Int64(this.jackpot.VirtualJK),
|
||||
}
|
||||
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) {
|
||||
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{} {
|
||||
return model.InsertBurstJackpotLogs(log)
|
||||
}), nil, "InsertBurstJackpotLogs").Start()
|
||||
|
@ -223,7 +223,7 @@ func (this *AvengersSceneData) RecordBurstLog(name string, wincoin, totalbet int
|
|||
|
||||
func (this *AvengersSceneData) BurstHistory(player *AvengersPlayerData) {
|
||||
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) {
|
||||
var logsp []*avengers.AvengersBurstHistoryInfo
|
||||
if data != nil {
|
||||
|
@ -251,7 +251,7 @@ func (this *AvengersSceneData) GetLastBurstJackPot() time.Time {
|
|||
}
|
||||
func (this *AvengersSceneData) SetLastBurstJackPot() {
|
||||
var randT = rand.Intn(25200-7200+1) + 7200
|
||||
switch this.DbGameFree.SceneType {
|
||||
switch this.GetDBGameFree().SceneType {
|
||||
case 1:
|
||||
randT = rand.Intn(25200-7200+1) + 7200
|
||||
case 2:
|
||||
|
@ -267,7 +267,7 @@ func (this *AvengersSceneData) SetLastBurstJackPot() {
|
|||
func (this *AvengersSceneData) AIAddJackPot() {
|
||||
if time.Now().Sub(this.lastJackPot) > 0 {
|
||||
var randT = rand.Intn(3) + 1
|
||||
switch this.DbGameFree.SceneType {
|
||||
switch this.GetDBGameFree().SceneType {
|
||||
case 1:
|
||||
randT = rand.Intn(3) + 1
|
||||
case 2:
|
||||
|
@ -280,20 +280,20 @@ func (this *AvengersSceneData) AIAddJackPot() {
|
|||
randT = rand.Intn(3) + 1
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
func (this *AvengersSceneData) AIBurstJackPot() {
|
||||
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
|
||||
this.SetLastBurstJackPot()
|
||||
jackpotParams := this.DbGameFree.GetJackpot()
|
||||
var jackpotInit = int64(jackpotParams[rule.AVENGERS_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) //奖池初始值
|
||||
jackpotParams := this.GetDBGameFree().GetJackpot()
|
||||
var jackpotInit = int64(jackpotParams[rule.AVENGERS_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) //奖池初始值
|
||||
|
||||
//AI机器人爆奖
|
||||
val := this.jackpot.VirtualJK
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
@ -314,11 +314,11 @@ func (this *AvengersSceneData) KickPlayerByTime() {
|
|||
}
|
||||
//for _, p := range this.players {
|
||||
// //游戏次数达到目标值
|
||||
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId()))
|
||||
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.GetDBGameFree().GetId()))
|
||||
// if !p.IsRob &&
|
||||
// todayGamefreeIDSceneData != nil &&
|
||||
// this.DbGameFree.GetPlayNumLimit() != 0 &&
|
||||
// todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) {
|
||||
// this.GetDBGameFree().GetPlayNumLimit() != 0 &&
|
||||
// todayGamefreeIDSceneData.GameTimes >= int64(this.GetDBGameFree().GetPlayNumLimit()) {
|
||||
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -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)
|
||||
if sceneEx, ok := s.ExtraData.(*AvengersSceneData); ok {
|
||||
playerEx := &AvengersPlayerData{Player: p}
|
||||
playerEx.init(s) // 玩家当前信息初始化
|
||||
playerEx.score = sceneEx.DbGameFree.GetBaseScore() // 底注
|
||||
playerEx.init(s) // 玩家当前信息初始化
|
||||
playerEx.score = sceneEx.GetDBGameFree().GetBaseScore() // 底注
|
||||
sceneEx.players[p.SnId] = playerEx
|
||||
p.ExtraData = playerEx
|
||||
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) {
|
||||
logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId)
|
||||
pack := &avengers.SCAvengersRoomInfo{
|
||||
RoomId: proto.Int(s.SceneId),
|
||||
RoomId: s.SceneId,
|
||||
Creator: proto.Int32(s.Creator),
|
||||
GameId: proto.Int(s.GameId),
|
||||
RoomMode: proto.Int(s.GameMode),
|
||||
GameId: s.GameId,
|
||||
RoomMode: s.GameMode,
|
||||
Params: common.CopySliceInt64ToInt32(s.Params),
|
||||
State: proto.Int(s.SceneState.GetState()),
|
||||
Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK),
|
||||
GameFreeId: proto.Int32(s.DbGameFree.Id),
|
||||
GameFreeId: proto.Int32(s.GetDBGameFree().Id),
|
||||
BilledData: data,
|
||||
}
|
||||
if playerEx != nil {
|
||||
|
@ -252,7 +252,7 @@ func AvengersSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *AvengersSceneD
|
|||
pack.Players = append(pack.Players, pd)
|
||||
pack.BetLines = playerEx.betLines
|
||||
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)
|
||||
if playerEx.totalPriceBonus > 0 {
|
||||
switch playerEx.bonusStage {
|
||||
|
@ -367,8 +367,8 @@ func (this *SceneStateAvengersStart) OnPlayerOp(s *base.Scene, p *base.Player, o
|
|||
return false
|
||||
}
|
||||
//先做底注校验
|
||||
if sceneEx.DbGameFree.GetBaseScore() != int32(params[0]) {
|
||||
logger.Logger.Warnf("avengers snid[%v] opcode[%v] params[%v] BaseScore[%v]", p.SnId, opcode, params, sceneEx.DbGameFree.GetBaseScore())
|
||||
if sceneEx.GetDBGameFree().GetBaseScore() != int32(params[0]) {
|
||||
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)
|
||||
return false
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ func (this *SceneStateAvengersStart) OnPlayerOp(s *base.Scene, p *base.Player, o
|
|||
if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin {
|
||||
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, avengers.OpResultCode_OPRC_CoinNotEnough, params)
|
||||
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)
|
||||
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)
|
||||
//税收比例
|
||||
taxRate := sceneEx.DbGameFree.GetTaxRate()
|
||||
taxRate := sceneEx.GetDBGameFree().GetTaxRate()
|
||||
if taxRate < 0 || taxRate > 10000 {
|
||||
logger.Logger.Warnf("AvengersErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate)
|
||||
taxRate = 500
|
||||
|
@ -448,8 +448,8 @@ func (this *SceneStateAvengersStart) OnPlayerOp(s *base.Scene, p *base.Player, o
|
|||
prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额
|
||||
|
||||
// 奖池参数
|
||||
jackpotParams := sceneEx.DbGameFree.GetJackpot()
|
||||
var jackpotInit = int64(jackpotParams[rule.AVENGERS_JACKPOT_InitJackpot]) * int64(sceneEx.DbGameFree.GetBaseScore()) //奖池初始值
|
||||
jackpotParams := sceneEx.GetDBGameFree().GetJackpot()
|
||||
var jackpotInit = int64(jackpotParams[rule.AVENGERS_JACKPOT_InitJackpot]) * int64(sceneEx.GetDBGameFree().GetBaseScore()) //奖池初始值
|
||||
|
||||
var jackpotFundAdd, prizeFundAdd int64 //奖池/水池增量
|
||||
if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注
|
||||
|
@ -469,7 +469,7 @@ func (this *SceneStateAvengersStart) OnPlayerOp(s *base.Scene, p *base.Player, o
|
|||
////统计参与游戏次数
|
||||
//if !sceneEx.Testing && !playerEx.IsRob {
|
||||
// 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)}},
|
||||
// }
|
||||
// proto.SetDefaults(pack)
|
||||
|
@ -668,7 +668,7 @@ func (this *SceneStateAvengersStart) OnPlayerOp(s *base.Scene, p *base.Player, o
|
|||
case AvengersPlayerHistory:
|
||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||
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{}
|
||||
for _, v := range gpl.Data {
|
||||
if v.GameDetailedLogId == "" {
|
||||
|
@ -806,7 +806,7 @@ func (this *SceneStateAvengersStart) BenchTest(s *base.Scene, p *base.Player) {
|
|||
file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,爆奖,中线倍数,中线数,剩余免费次数\r\n")
|
||||
|
||||
oldCoin := p.Coin
|
||||
p.Coin = 5000 * int64(s.DbGameFree.GetBaseScore())
|
||||
p.Coin = 5000 * int64(s.GetDBGameFree().GetBaseScore())
|
||||
if playerEx, ok := p.ExtraData.(*AvengersPlayerData); ok {
|
||||
for i := 0; i < BENCH_CNT; i++ {
|
||||
startCoin := p.Coin
|
||||
|
@ -817,7 +817,7 @@ func (this *SceneStateAvengersStart) BenchTest(s *base.Scene, p *base.Player) {
|
|||
inCoin := int64(playerEx.RollGameType.BaseResult.TotalBet)
|
||||
outCoin := playerEx.RollGameType.BaseResult.ChangeCoin + inCoin
|
||||
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)
|
||||
|
||||
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")
|
||||
oldCoin := p.Coin
|
||||
switch s.DbGameFree.GetSceneType() {
|
||||
switch s.GetDBGameFree().GetSceneType() {
|
||||
case 1:
|
||||
p.Coin = 100000
|
||||
case 2:
|
||||
|
@ -883,7 +883,7 @@ func (this *SceneStateAvengersStart) WinTargetBenchTest(s *base.Scene, p *base.P
|
|||
inCoin := int64(playerEx.RollGameType.BaseResult.TotalBet)
|
||||
outCoin := playerEx.RollGameType.BaseResult.ChangeCoin + inCoin
|
||||
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)
|
||||
|
||||
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
|
||||
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.AfterCoin = playerEx.Coin
|
||||
playerEx.RollGameType.BaseResult.BeforeCoin = startCoin
|
||||
|
@ -974,8 +974,8 @@ func AvengersCheckAndSaveLog(sceneEx *AvengersSceneData, playerEx *AvengersPlaye
|
|||
GameCoinTs: proto.Int64(playerEx.GameCoinTs),
|
||||
}
|
||||
gwPlayerBet := &server.GWPlayerData{
|
||||
SceneId: proto.Int(sceneEx.SceneId),
|
||||
GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()),
|
||||
SceneId: sceneEx.SceneId,
|
||||
GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
|
||||
}
|
||||
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
|
||||
sceneEx.SyncPlayerDatas(&base.PlayerDataParam{
|
||||
|
|
|
@ -2,5 +2,5 @@ package base
|
|||
|
||||
// 提供税收和流水,根据代理需求后台进行分账
|
||||
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))
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ func (this *Player) SyncFlagToWorld() {
|
|||
}
|
||||
pack := &server.GWPlayerFlag{
|
||||
SnId: proto.Int32(this.SnId),
|
||||
RoomId: proto.Int(this.scene.SceneId),
|
||||
RoomId: this.scene.SceneId,
|
||||
Flag: proto.Int(this.flag),
|
||||
}
|
||||
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())
|
||||
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.CreateTime, gamingTime, gameFirstTime, gameFreeFirstTime, gameTimes, gameFreeTimes, this.LastLoginTime,
|
||||
this.TelephonePromoter, this.DeviceId)))
|
||||
|
|
|
@ -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)
|
||||
testFlag = true
|
||||
if oldPlayer.scene != nil {
|
||||
logger.Logger.Warnf("(this *PlayerMgr) AddPlayer found snid=%v in sceneid=%v", id, oldPlayer.SnId, oldPlayer.scene.SceneId)
|
||||
if SceneMgrSington.GetScene(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", id, oldPlayer.SnId, oldPlayer.scene.SceneId)
|
||||
if SceneMgrSington.GetScene(int(oldPlayer.scene.SceneId)) != nil {
|
||||
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)
|
||||
|
|
|
@ -13,11 +13,6 @@ import (
|
|||
"mongo.games.com/goserver/core/netlib"
|
||||
)
|
||||
|
||||
const (
|
||||
ReplayServerType int = 8
|
||||
ReplayServerId = 801
|
||||
)
|
||||
|
||||
var _replayIgnorePacketIds = map[int]bool{}
|
||||
|
||||
type ReplayRecorder struct {
|
||||
|
@ -97,13 +92,13 @@ func (this *ReplayRecorder) Fini(s *Scene) {
|
|||
// todo dev
|
||||
//Rec: this.rs,
|
||||
LogId: proto.String(this.Logid),
|
||||
GameId: proto.Int32(s.DbGameFree.GetGameId()),
|
||||
RoomMode: proto.Int32(s.DbGameFree.GetGameMode()),
|
||||
GameId: int32(s.GetGameId()),
|
||||
RoomMode: int32(s.GetGameMode()),
|
||||
NumOfGames: proto.Int(s.NumOfGames),
|
||||
Platform: proto.String(s.Platform),
|
||||
DatasVer: proto.Int32(s.rrVer),
|
||||
GameFreeid: proto.Int32(s.GetGameFreeId()),
|
||||
RoomId: proto.Int(s.SceneId),
|
||||
RoomId: s.SceneId,
|
||||
}
|
||||
if s.ClubId != 0 {
|
||||
pack.ClubId = proto.Int32(s.ClubId)
|
||||
|
|
|
@ -11,7 +11,6 @@ import (
|
|||
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/core/timer"
|
||||
"mongo.games.com/goserver/core/utils"
|
||||
srvlibproto "mongo.games.com/goserver/srvlib/protocol"
|
||||
|
||||
|
@ -37,163 +36,96 @@ type CanRebindSnId interface {
|
|||
RebindPlayerSnId(oldSnId, newSnId int32)
|
||||
}
|
||||
|
||||
type ItemInfo struct {
|
||||
Id int32
|
||||
Num int64
|
||||
}
|
||||
|
||||
// todo 结构优化
|
||||
type Scene struct {
|
||||
ws *netlib.Session // 大厅服
|
||||
Rand *rand.Rand // 随机数生成器
|
||||
ExtraData interface{} // 房间数据
|
||||
matchData interface{} // 比赛房数据
|
||||
aiMgr AIMgr //
|
||||
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
|
||||
*server.WGCreateScene
|
||||
ws *netlib.Session // 大厅服
|
||||
Rand *rand.Rand // 随机数生成器
|
||||
ExtraData interface{} // 房间数据
|
||||
aiMgr AIMgr //
|
||||
WithLocalAI bool //
|
||||
disbandGen int //第几次解散申请
|
||||
disbandParam []int64 //解散参数
|
||||
disbandPos int32 //发起解散的玩家位置
|
||||
disbandTs int64 //解散发起时间戳
|
||||
playerNum int //游戏人数
|
||||
realPlayerNum int //真实玩家人数
|
||||
robotNum int //机器人数量
|
||||
robotLimit int //最大限制机器人数量
|
||||
robotNumLastInvite int //上次邀请机器人时的数量
|
||||
TotalOfGames int //游戏总局数
|
||||
NumOfGames int //局数
|
||||
Players map[int32]*Player //参与者
|
||||
audiences map[int32]*Player //观众
|
||||
sp ScenePolicy //场景游戏策略
|
||||
//mp MatchPolicy //场景比赛策略
|
||||
rr *ReplayRecorder //回放记录器
|
||||
rrVer int32 //录像的协议版本号
|
||||
DbGameFree *server.DB_GameFree //自由场数据
|
||||
SceneState SceneState //场景状态
|
||||
hDisband timer.TimerHandle //解散handle
|
||||
StateStartTime time.Time //状态开始时间
|
||||
stateEndTime time.Time //状态结束时间
|
||||
GameStartTime time.Time //游戏开始计时时间
|
||||
GameNowTime time.Time //当局游戏开始时间
|
||||
nextInviteTime time.Time //下次邀请机器人时间
|
||||
inviteInterval int64 //邀请间隔
|
||||
pause bool
|
||||
Gaming bool
|
||||
destroyed bool
|
||||
completed bool
|
||||
Testing bool //是否为测试场
|
||||
graceDestroy bool //等待销毁
|
||||
replayAddId int32
|
||||
KeyGameId string //游戏类型唯一ID
|
||||
KeyGamefreeId string //游戏场次唯一id
|
||||
KeyGameDif string
|
||||
GroupId int32 //分组id
|
||||
bEnterAfterStart bool //是否允许中途加入
|
||||
ClubId int32
|
||||
RoomId string //俱乐部那个包间
|
||||
RoomPos int32 //房间桌号
|
||||
PumpCoin int32 //抽水比例,同一个俱乐部下面的抽水比例是一定的,百分比
|
||||
DealyTime int64 //结算延时时间
|
||||
CpCtx model.CoinPoolCtx //水池环境
|
||||
CpControlled bool //被水池控制了
|
||||
timerRandomRobot int64
|
||||
nogDismiss int //检查机器人离场时的局数(同一局只检查一次)
|
||||
//playerStatement map[int32]*webapi.PlayerStatement //玩家流水记录
|
||||
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
|
||||
rr *ReplayRecorder //回放记录器
|
||||
rrVer int32 //录像的协议版本号
|
||||
SceneState SceneState //场景状态
|
||||
StateStartTime time.Time //状态开始时间
|
||||
stateEndTime time.Time //状态结束时间
|
||||
GameStartTime time.Time //游戏开始计时时间
|
||||
GameNowTime time.Time //当局游戏开始时间
|
||||
nextInviteTime time.Time //下次邀请机器人时间
|
||||
inviteInterval int64 //邀请间隔
|
||||
pause bool
|
||||
Gaming bool
|
||||
destroyed bool
|
||||
completed bool
|
||||
Testing bool //是否为测试场
|
||||
graceDestroy bool //等待销毁
|
||||
replayAddId int32
|
||||
KeyGameId string //游戏类型唯一ID
|
||||
KeyGamefreeId string //游戏场次唯一id
|
||||
KeyGameDif string
|
||||
GroupId int32 //分组id
|
||||
bEnterAfterStart bool //是否允许中途加入
|
||||
ClubId int32
|
||||
RoomId string //俱乐部那个包间
|
||||
RoomPos int32 //房间桌号
|
||||
PumpCoin int32 //抽水比例,同一个俱乐部下面的抽水比例是一定的,百分比
|
||||
DealyTime int64 //结算延时时间
|
||||
CpCtx model.CoinPoolCtx //水池环境
|
||||
CpControlled bool //被水池控制了
|
||||
timerRandomRobot int64
|
||||
nogDismiss int //检查机器人离场时的局数(同一局只检查一次)
|
||||
SystemCoinOut int64 //本局游戏机器人营收 机器人赢:正值 机器人输:负值
|
||||
ChessRank []int32
|
||||
RealCtrl bool
|
||||
CycleID string
|
||||
}
|
||||
|
||||
func NewScene(ws *netlib.Session, sceneId, gameMode, sceneMode, gameId int, platform string, params []int64,
|
||||
agentor, creator int32, replayCode string, hallId, groupId, totalOfGames int32, dbGameFree *server.DB_GameFree,
|
||||
bEnterAfterStart bool, baseScore int32, playerNum int, cherank []int32) *Scene {
|
||||
func NewScene(args *CreateSceneParam) *Scene {
|
||||
gameId := int(args.GetGameId())
|
||||
gameMode := int(args.GetGameMode())
|
||||
sp := GetScenePolicy(gameId, gameMode)
|
||||
if sp == nil {
|
||||
logger.Logger.Errorf("Game id %v not register in ScenePolicyPool.", gameId)
|
||||
return nil
|
||||
}
|
||||
|
||||
tNow := time.Now()
|
||||
s := &Scene{
|
||||
ws: ws,
|
||||
SceneId: sceneId,
|
||||
GameId: gameId,
|
||||
GameMode: gameMode,
|
||||
SceneMode: sceneMode,
|
||||
SceneType: int(dbGameFree.GetSceneType()),
|
||||
Params: params,
|
||||
Creator: creator,
|
||||
replayCode: replayCode,
|
||||
WGCreateScene: args.WGCreateScene,
|
||||
ws: args.Session,
|
||||
Players: make(map[int32]*Player),
|
||||
audiences: make(map[int32]*Player),
|
||||
sp: sp,
|
||||
hDisband: timer.TimerHandle(0),
|
||||
GameStartTime: tNow,
|
||||
hallId: hallId,
|
||||
Platform: platform,
|
||||
DbGameFree: dbGameFree,
|
||||
inviteInterval: model.GameParamData.RobotInviteInitInterval,
|
||||
GroupId: groupId,
|
||||
bEnterAfterStart: bEnterAfterStart,
|
||||
TotalOfGames: int(totalOfGames),
|
||||
BaseScore: baseScore,
|
||||
playerNum: playerNum,
|
||||
ChessRank: cherank,
|
||||
bEnterAfterStart: args.GetEnterAfterStart(),
|
||||
ChessRank: args.GetChessRank(),
|
||||
KeyGameId: strconv.Itoa(int(args.GetGameId())),
|
||||
KeyGamefreeId: strconv.Itoa(int(args.GetDBGameFree().GetId())),
|
||||
KeyGameDif: args.GetDBGameFree().GetGameDif(),
|
||||
}
|
||||
s.CycleID, _ = model.AutoIncGameLogId()
|
||||
if s != nil && s.init() {
|
||||
logger.Logger.Trace("NewScene init success.")
|
||||
if !s.Testing {
|
||||
s.rrVer = ReplayRecorderVer[gameId]
|
||||
s.RecordReplayStart()
|
||||
}
|
||||
return s
|
||||
} else {
|
||||
logger.Logger.Trace("NewScene init failed.")
|
||||
return nil
|
||||
}
|
||||
s.init()
|
||||
return s
|
||||
}
|
||||
|
||||
//func (this *Scene) BindAIMgr(aimgr AIMgr) {
|
||||
// this.aiMgr = aimgr
|
||||
//}
|
||||
|
||||
// 根据gamedifid,转为gameid,然后返回所有的相同gameid的数据
|
||||
func (this *Scene) GetTotalTodayDaliyGameData(keyGameId string, pd *Player) *model.PlayerGameStatics {
|
||||
todayData := model.NewPlayerGameStatics()
|
||||
|
||||
if pd.TodayGameData == nil {
|
||||
return todayData
|
||||
func (this *Scene) GetSceneType() int32 {
|
||||
if this.GetDBGameFree() != nil {
|
||||
return this.GetDBGameFree().GetSceneType()
|
||||
}
|
||||
|
||||
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
|
||||
return 0
|
||||
}
|
||||
|
||||
func (this *Scene) RebindPlayerSnId(oldSnId, newSnId int32) {
|
||||
|
@ -220,10 +152,6 @@ func (this *Scene) init() bool {
|
|||
this.Rand = rand.New(rand.NewSource(sceneRandSeed))
|
||||
this.nextInviteTime = tNow.Add(time.Second * time.Duration(this.Rand.Int63n(model.GameParamData.RobotInviteInitInterval)))
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -236,22 +164,13 @@ func (this *Scene) GetParam(idx int) int64 {
|
|||
}
|
||||
|
||||
func (this *Scene) GetBetMap() []int64 {
|
||||
return this.DbGameFree.GetOtherIntParams()
|
||||
}
|
||||
|
||||
func (this *Scene) IsDisbanding() bool {
|
||||
return this.hDisband != timer.TimerHandle(0)
|
||||
return this.GetDBGameFree().GetOtherIntParams()
|
||||
}
|
||||
|
||||
func (this *Scene) GetGameFreeId() int32 {
|
||||
return this.DbGameFree.Id
|
||||
}
|
||||
func (this *Scene) GetDBGameFree() *server.DB_GameFree {
|
||||
return this.DbGameFree
|
||||
}
|
||||
func (this *Scene) GetPlatform() string {
|
||||
return this.Platform
|
||||
return this.GetDBGameFree().GetId()
|
||||
}
|
||||
|
||||
func (this *Scene) GetKeyGameId() string {
|
||||
return this.KeyGameId
|
||||
}
|
||||
|
@ -259,10 +178,10 @@ func (this *Scene) SetKeyGameId(keyGameId string) {
|
|||
this.KeyGameId = keyGameId
|
||||
}
|
||||
func (this *Scene) GetSceneId() int {
|
||||
return this.SceneId
|
||||
return int(this.SceneId)
|
||||
}
|
||||
func (this *Scene) SetSceneId(sceneId int) {
|
||||
this.SceneId = sceneId
|
||||
this.SceneId = int32(sceneId)
|
||||
}
|
||||
func (this *Scene) GetGroupId() int32 {
|
||||
return this.GroupId
|
||||
|
@ -283,22 +202,22 @@ func (this *Scene) SetSceneState(state SceneState) {
|
|||
this.SceneState = state
|
||||
}
|
||||
func (this *Scene) GetGameId() int {
|
||||
return this.GameId
|
||||
return int(this.GameId)
|
||||
}
|
||||
func (this *Scene) SetGameId(gameId int) {
|
||||
this.GameId = gameId
|
||||
this.GameId = int32(gameId)
|
||||
}
|
||||
func (this *Scene) GetPlayerNum() int {
|
||||
return this.playerNum
|
||||
return int(this.WGCreateScene.GetPlayerNum())
|
||||
}
|
||||
func (this *Scene) SetPlayerNum(playerNum int) {
|
||||
this.playerNum = playerNum
|
||||
this.PlayerNum = int32(playerNum)
|
||||
}
|
||||
func (this *Scene) GetGameMode() int {
|
||||
return this.GameMode
|
||||
return int(this.GameMode)
|
||||
}
|
||||
func (this *Scene) SetGameMode(gameMode int) {
|
||||
this.GameMode = gameMode
|
||||
this.GameMode = int32(gameMode)
|
||||
}
|
||||
func (this *Scene) GetGaming() bool {
|
||||
return this.Gaming
|
||||
|
@ -319,17 +238,15 @@ func (this *Scene) SetCreator(creator int32) {
|
|||
this.Creator = creator
|
||||
}
|
||||
func (this *Scene) GetSceneMode() int {
|
||||
return this.SceneMode
|
||||
return int(this.SceneMode)
|
||||
}
|
||||
func (this *Scene) SetSceneMode(sceneMode int) {
|
||||
this.SceneMode = sceneMode
|
||||
this.SceneMode = int32(sceneMode)
|
||||
}
|
||||
func (this *Scene) GetParams() []int64 {
|
||||
return this.Params
|
||||
}
|
||||
func (this *Scene) SetParams(params []int64) {
|
||||
this.Params = params
|
||||
}
|
||||
|
||||
func (this *Scene) GetStateStartTime() time.Time {
|
||||
return this.StateStartTime
|
||||
}
|
||||
|
@ -453,9 +370,9 @@ func (this *Scene) PlayerEnter(p *Player, isLoaded bool) {
|
|||
p.scene = this
|
||||
|
||||
pack := &gamehall.SCEnterRoom{
|
||||
GameId: proto.Int(this.GameId),
|
||||
ModeType: proto.Int(this.GameMode),
|
||||
RoomId: proto.Int(this.SceneId),
|
||||
GameId: this.GameId,
|
||||
ModeType: this.GameMode,
|
||||
RoomId: this.SceneId,
|
||||
OpRetCode: gamehall.OpResultCode_Game_OPRC_Sucess_Game,
|
||||
Params: []int32{},
|
||||
ClubId: proto.Int32(this.ClubId),
|
||||
|
@ -465,7 +382,7 @@ func (this *Scene) PlayerEnter(p *Player, isLoaded bool) {
|
|||
|
||||
if p.IsRob {
|
||||
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 {
|
||||
p.Trusteeship = 0
|
||||
p.ValidCacheBetTotal = 0
|
||||
|
@ -482,7 +399,7 @@ func (this *Scene) PlayerEnter(p *Player, isLoaded bool) {
|
|||
utils.RunPanicless(func() { this.sp.OnPlayerEnter(this, p) })
|
||||
|
||||
if p.WBLevel < 0 {
|
||||
WarningBlackPlayer(p.SnId, this.DbGameFree.Id)
|
||||
WarningBlackPlayer(p.SnId, this.GetDBGameFree().Id)
|
||||
}
|
||||
|
||||
this.ResetNextInviteTime()
|
||||
|
@ -501,7 +418,7 @@ func (this *Scene) PlayerLeave(p *Player, reason int, isBill bool) {
|
|||
pack := &gamehall.SCLeaveRoom{
|
||||
//OpRetCode: p.opCode, //protocol.OpResultCode_OPRC_Hundred_YouHadBetCannotLeave,
|
||||
OpRetCode: gamehall.OpResultCode_Game(p.OpCode),
|
||||
RoomId: proto.Int(this.SceneId),
|
||||
RoomId: this.SceneId,
|
||||
}
|
||||
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离开房间
|
||||
pack := &server.GWPlayerLeave{
|
||||
RoomId: proto.Int(this.SceneId),
|
||||
RoomId: this.SceneId,
|
||||
PlayerId: proto.Int32(p.SnId),
|
||||
Reason: proto.Int(reason),
|
||||
ServiceFee: proto.Int64(p.serviceFee),
|
||||
|
@ -533,7 +450,7 @@ func (this *Scene) PlayerLeave(p *Player, reason int, isBill bool) {
|
|||
LostTimes: proto.Int(p.lostTimes),
|
||||
TotalConvertibleFlow: proto.Int64(p.TotalConvertibleFlow),
|
||||
ValidCacheBetTotal: proto.Int64(p.ValidCacheBetTotal),
|
||||
MatchId: this.MatchId,
|
||||
MatchId: this.GetMatch().GetMatchSortId(),
|
||||
CurIsWin: proto.Int64(p.CurIsWin), // 负数:输 0:平局 正数:赢
|
||||
}
|
||||
matchRobotGrades := p.MatchRobotGrades
|
||||
|
@ -551,7 +468,7 @@ func (this *Scene) PlayerLeave(p *Player, reason int, isBill bool) {
|
|||
}
|
||||
pack.GameCoinTs = proto.Int64(p.GameCoinTs)
|
||||
if !p.IsLocal {
|
||||
data, err := p.MarshalData(this.GameId)
|
||||
data, err := p.MarshalData(int(this.GameId))
|
||||
if err == nil {
|
||||
pack.PlayerData = data
|
||||
}
|
||||
|
@ -581,7 +498,7 @@ func (this *Scene) PlayerLeave(p *Player, reason int, isBill bool) {
|
|||
}
|
||||
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 {
|
||||
this.realPlayerNum--
|
||||
this.RandRobotCnt()
|
||||
|
@ -596,9 +513,9 @@ func (this *Scene) AudienceEnter(p *Player, isload bool) {
|
|||
p.scene = this
|
||||
p.MarkFlag(PlayerState_Audience)
|
||||
pack := &gamehall.SCEnterRoom{
|
||||
GameId: proto.Int(this.GameId),
|
||||
ModeType: proto.Int(this.GameMode),
|
||||
RoomId: proto.Int(this.SceneId),
|
||||
GameId: this.GameId,
|
||||
ModeType: this.GameMode,
|
||||
RoomId: this.SceneId,
|
||||
OpRetCode: gamehall.OpResultCode_Game_OPRC_Sucess_Game,
|
||||
}
|
||||
proto.SetDefaults(pack)
|
||||
|
@ -618,7 +535,7 @@ func (this *Scene) AudienceLeave(p *Player, reason int) {
|
|||
if !this.CanChangeCoinScene(p) {
|
||||
pack := &gamehall.SCLeaveRoom{
|
||||
OpRetCode: gamehall.OpResultCode_Game(p.OpCode), //protocol.OpResultCode_OPRC_Hundred_YouHadBetCannotLeave,
|
||||
RoomId: proto.Int(this.SceneId),
|
||||
RoomId: this.SceneId,
|
||||
}
|
||||
proto.SetDefaults(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)
|
||||
//send world离开房间
|
||||
pack := &server.GWPlayerLeave{
|
||||
RoomId: proto.Int(this.SceneId),
|
||||
RoomId: this.SceneId,
|
||||
PlayerId: proto.Int32(p.SnId),
|
||||
Reason: proto.Int(reason),
|
||||
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) {
|
||||
logger.Logger.Trace("(this *Scene) PlayerReturn")
|
||||
pack := &gamehall.SCReturnRoom{
|
||||
RoomId: proto.Int(this.SceneId),
|
||||
GameId: proto.Int(this.GameId),
|
||||
ModeType: proto.Int(this.GameMode),
|
||||
RoomId: this.SceneId,
|
||||
GameId: this.GameId,
|
||||
ModeType: this.GameMode,
|
||||
Params: common.CopySliceInt64ToInt32(this.Params),
|
||||
HallId: proto.Int32(this.hallId),
|
||||
HallId: this.GetDBGameFree().GetId(),
|
||||
IsLoaded: proto.Bool(isLoaded),
|
||||
OpRetCode: gamehall.OpResultCode_Game_OPRC_Sucess_Game,
|
||||
ClubId: proto.Int32(this.ClubId),
|
||||
|
@ -964,7 +881,7 @@ func (this *Scene) Destroy(force bool) {
|
|||
}
|
||||
|
||||
isCompleted := this.sp.IsCompleted(this) || this.completed
|
||||
SceneMgrSington.DestroyScene(this.SceneId)
|
||||
SceneMgrSington.DestroyScene(int(this.SceneId))
|
||||
pack := &server.GWDestroyScene{
|
||||
SceneId: int64(this.SceneId),
|
||||
IsCompleted: isCompleted,
|
||||
|
@ -998,7 +915,7 @@ func (this *Scene) IsCustom() 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 {
|
||||
if this.DbGameFree != nil {
|
||||
return this.DbGameFree.GetLowerThanKick()
|
||||
if this.GetDBGameFree() != nil {
|
||||
return this.GetDBGameFree().GetLowerThanKick()
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (this *Scene) GetCoinSceneMaxCoinLimit() int64 {
|
||||
if this.DbGameFree != nil {
|
||||
return this.DbGameFree.GetMaxCoinLimit()
|
||||
if this.GetDBGameFree() != nil {
|
||||
return this.GetDBGameFree().GetMaxCoinLimit()
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
@ -1044,7 +961,7 @@ func (this *Scene) CoinInLimitLocal(coin int64) bool {
|
|||
|
||||
// NotCoinInLimitType 金额超出入场限额,返回踢出类型
|
||||
func (this *Scene) NotCoinInLimitType(coin int64) int {
|
||||
if common.IsLocalGame(this.GameId) {
|
||||
if common.IsLocalGame(int(this.GameId)) {
|
||||
minCoin := this.GetLimitCoin()
|
||||
if minCoin != 0 && coin < minCoin {
|
||||
return common.PlayerLeaveReason_Bekickout
|
||||
|
@ -1071,7 +988,7 @@ func (this *Scene) NotCoinInLimitType(coin int64) int {
|
|||
|
||||
// CoinInLimit 单入场限额检查
|
||||
func (this *Scene) CoinInLimit(coin int64) bool {
|
||||
if common.IsLocalGame(this.GameId) {
|
||||
if common.IsLocalGame(int(this.GameId)) {
|
||||
return this.CoinInLimitLocal(coin)
|
||||
}
|
||||
|
||||
|
@ -1094,7 +1011,7 @@ func (this *Scene) GetLimitCoin() int64 {
|
|||
limitCoin := int64(0)
|
||||
tmpIds := []int32{}
|
||||
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()
|
||||
if len(betRange) == 0 {
|
||||
continue
|
||||
|
@ -1143,8 +1060,8 @@ func (this *Scene) CoinOverMaxLimit(coin int64, p *Player) bool {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if this.DbGameFree != nil {
|
||||
limit := this.DbGameFree.GetRobotLimitCoin()
|
||||
if this.GetDBGameFree() != nil {
|
||||
limit := this.GetDBGameFree().GetRobotLimitCoin()
|
||||
if len(limit) >= 2 {
|
||||
comp := common.RandInt(int(limit[0]), int(limit[1]))
|
||||
if coin > int64(comp) {
|
||||
|
@ -1168,32 +1085,32 @@ func (this *Scene) CorrectBillCoin(coin, limit1, limit2 int64) int64 {
|
|||
}
|
||||
|
||||
func (this *Scene) GetCoinSceneServiceFee() int32 {
|
||||
if this.DbGameFree != nil {
|
||||
return this.DbGameFree.GetServiceFee()
|
||||
if this.GetDBGameFree() != nil {
|
||||
return this.GetDBGameFree().GetServiceFee()
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (this *Scene) GetCoinSceneTypeId() int32 {
|
||||
if this.DbGameFree != nil {
|
||||
return this.DbGameFree.Id
|
||||
if this.GetDBGameFree() != nil {
|
||||
return this.GetDBGameFree().Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (this *Scene) GetCoinSceneName() string {
|
||||
if this.DbGameFree != nil {
|
||||
return this.DbGameFree.GetName() + this.DbGameFree.GetTitle()
|
||||
if this.GetDBGameFree() != nil {
|
||||
return this.GetDBGameFree().GetName() + this.GetDBGameFree().GetTitle()
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (this *Scene) GetHundredSceneName() string {
|
||||
if this.IsHundredScene() && this.DbGameFree != nil {
|
||||
if this.DbGameFree.GetName() == this.DbGameFree.GetTitle() {
|
||||
return this.DbGameFree.GetTitle()
|
||||
if this.IsHundredScene() && this.GetDBGameFree() != nil {
|
||||
if this.GetDBGameFree().GetName() == this.GetDBGameFree().GetTitle() {
|
||||
return this.GetDBGameFree().GetTitle()
|
||||
} else {
|
||||
return this.DbGameFree.GetName() + this.DbGameFree.GetTitle()
|
||||
return this.GetDBGameFree().GetName() + this.GetDBGameFree().GetTitle()
|
||||
}
|
||||
}
|
||||
return ""
|
||||
|
@ -1272,10 +1189,10 @@ func (this *Scene) SyncSceneState(state int) {
|
|||
|
||||
func (this *Scene) NotifySceneRoundStart(round int) {
|
||||
pack := &server.GWSceneStart{
|
||||
RoomId: proto.Int(this.SceneId),
|
||||
RoomId: this.SceneId,
|
||||
CurrRound: proto.Int(round),
|
||||
Start: proto.Bool(true),
|
||||
MaxRound: proto.Int(this.TotalOfGames),
|
||||
MaxRound: this.TotalOfGames,
|
||||
}
|
||||
proto.SetDefaults(pack)
|
||||
this.SendToWorld(int(server.SSPacketID_PACKET_GW_SCENESTART), pack)
|
||||
|
@ -1283,10 +1200,10 @@ func (this *Scene) NotifySceneRoundStart(round int) {
|
|||
|
||||
func (this *Scene) NotifySceneRoundPause() {
|
||||
pack := &server.GWSceneStart{
|
||||
RoomId: proto.Int(this.SceneId),
|
||||
RoomId: this.SceneId,
|
||||
Start: proto.Bool(false),
|
||||
CurrRound: proto.Int(this.NumOfGames),
|
||||
MaxRound: proto.Int(this.TotalOfGames),
|
||||
MaxRound: this.TotalOfGames,
|
||||
}
|
||||
proto.SetDefaults(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) {
|
||||
if this.SceneState != nil {
|
||||
pack := &server.GWGameState{
|
||||
SceneId: proto.Int(this.SceneId),
|
||||
SceneId: this.SceneId,
|
||||
State: proto.Int(this.SceneState.GetState()),
|
||||
Ts: proto.Int64(time.Now().Unix()),
|
||||
Sec: proto.Int(sec),
|
||||
|
@ -1309,8 +1226,8 @@ func (this *Scene) SyncGameState(sec, bl int) {
|
|||
// SyncScenePlayer 游戏开始的时候同步防伙牌数据
|
||||
func (this *Scene) SyncScenePlayer() {
|
||||
pack := &server.GWScenePlayerLog{
|
||||
GameId: proto.Int(this.GameId),
|
||||
GameFreeId: proto.Int32(this.DbGameFree.GetId()),
|
||||
GameId: this.GameId,
|
||||
GameFreeId: proto.Int32(this.GetDBGameFree().GetId()),
|
||||
}
|
||||
for _, value := range this.Players {
|
||||
if value.IsRob || !value.IsGameing() {
|
||||
|
@ -1323,7 +1240,7 @@ func (this *Scene) SyncScenePlayer() {
|
|||
|
||||
func (this *Scene) RecordReplayStart() {
|
||||
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)
|
||||
this.rr = NewReplayRecorder(id)
|
||||
}
|
||||
|
@ -1331,7 +1248,7 @@ func (this *Scene) RecordReplayStart() {
|
|||
|
||||
func (this *Scene) RecordReplayOver() {
|
||||
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.rr.Fini(this)
|
||||
|
||||
|
@ -1370,7 +1287,7 @@ func (this *Scene) TryDismissRob(params ...int) {
|
|||
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
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
for _, r := range this.Players {
|
||||
if r.IsRob {
|
||||
|
@ -1430,7 +1347,7 @@ func (this *Scene) TryDismissRob(params ...int) {
|
|||
|
||||
func (this *Scene) CreateGameRecPacket() *server.GWGameRec {
|
||||
return &server.GWGameRec{
|
||||
RoomId: proto.Int(this.SceneId),
|
||||
RoomId: this.SceneId,
|
||||
NumOfGames: proto.Int(this.NumOfGames),
|
||||
GameTime: proto.Int(int(time.Now().Sub(this.GameStartTime) / time.Second)),
|
||||
}
|
||||
|
@ -1507,7 +1424,7 @@ func (this *Scene) CoinPoolCanOut() bool {
|
|||
if setting != nil {
|
||||
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.Testing { //测试场屏蔽掉
|
||||
trend20Lately := gameDetailedParam.Trend20Lately
|
||||
baseScore := this.DbGameFree.GetBaseScore()
|
||||
if common.IsLocalGame(this.GameId) {
|
||||
baseScore := this.GetDBGameFree().GetBaseScore()
|
||||
if common.IsLocalGame(int(this.GameId)) {
|
||||
baseScore = this.BaseScore
|
||||
}
|
||||
if this.IsCoinScene() {
|
||||
|
@ -1541,13 +1458,13 @@ func (this *Scene) SaveGameDetailedLog(logid string, gamedetailednote string, ga
|
|||
if _, ok := mapPlatform[p.Platform]; !ok {
|
||||
mapPlatform[p.Platform] = true
|
||||
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,
|
||||
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)
|
||||
if log != nil {
|
||||
if this.IsMatchScene() {
|
||||
log.MatchId = this.MatchId
|
||||
log.MatchId = this.GetMatch().GetMatchSortId()
|
||||
}
|
||||
if this.IsCustom() {
|
||||
log.CycleId = this.CycleID
|
||||
|
@ -1558,13 +1475,13 @@ func (this *Scene) SaveGameDetailedLog(logid string, gamedetailednote string, ga
|
|||
}
|
||||
} else {
|
||||
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,
|
||||
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)
|
||||
if log != nil {
|
||||
if this.IsMatchScene() {
|
||||
log.MatchId = this.MatchId
|
||||
log.MatchId = this.GetMatch().GetMatchSortId()
|
||||
}
|
||||
if this.IsCustom() {
|
||||
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 {
|
||||
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 {
|
||||
LogChannelSingleton.WriteLog(log)
|
||||
}
|
||||
|
@ -1642,12 +1559,12 @@ func (this *Scene) SaveGamePlayerListLog(snid int32, param *SaveGamePlayerListLo
|
|||
playerEx := this.GetPlayer(snid)
|
||||
//有些结算的时候,玩家已经退场,不要用是否在游戏,0709,修改为扣税后数值
|
||||
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.TotalFlow += totalFlow
|
||||
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)
|
||||
//分配利润
|
||||
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,所有场次操作记录放一起
|
||||
roomType = 0
|
||||
}
|
||||
baseScore := this.DbGameFree.GetBaseScore()
|
||||
if common.IsLocalGame(this.GameId) {
|
||||
baseScore := this.GetDBGameFree().GetBaseScore()
|
||||
if common.IsLocalGame(int(this.GameId)) {
|
||||
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,
|
||||
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,
|
||||
param.BetAmount, param.WinAmountNoAnyTax, this.KeyGameId, Name, this.DbGameFree.GetGameClass(),
|
||||
param.IsFirstGame, this.MatchId, this.MatchType, param.IsFree, param.WinSmallGame, param.WinTotal)
|
||||
param.BetAmount, param.WinAmountNoAnyTax, this.KeyGameId, Name, this.GetDBGameFree().GetGameClass(),
|
||||
param.IsFirstGame, this.GetMatch().GetMatchSortId(), int64(this.GetMatch().GetMatchType()), param.IsFree, param.WinSmallGame, param.WinTotal)
|
||||
if log != nil {
|
||||
LogChannelSingleton.WriteLog(log)
|
||||
}
|
||||
|
@ -1708,9 +1625,9 @@ func (this *Scene) RobotIsLimit() bool {
|
|||
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
|
||||
}
|
||||
} else if this.IsHundredScene() {
|
||||
|
@ -1723,11 +1640,11 @@ func (this *Scene) RobotIsLimit() bool {
|
|||
}
|
||||
|
||||
func (this *Scene) RandRobotCnt() {
|
||||
if this.DbGameFree != nil {
|
||||
if this.DbGameFree.GetMatchMode() == 1 {
|
||||
if this.GetDBGameFree() != nil {
|
||||
if this.GetDBGameFree().GetMatchMode() == 1 {
|
||||
return
|
||||
}
|
||||
numrng := this.DbGameFree.GetRobotNumRng()
|
||||
numrng := this.GetDBGameFree().GetRobotNumRng()
|
||||
if len(numrng) >= 2 {
|
||||
if numrng[1] == numrng[0] {
|
||||
this.robotLimit = int(numrng[0])
|
||||
|
@ -1748,7 +1665,7 @@ func (this *Scene) GetRobotTime() int64 {
|
|||
}
|
||||
|
||||
func (this *Scene) IsPreCreateScene() bool {
|
||||
return this.DbGameFree.GetCreateRoomNum() > 0
|
||||
return this.GetDBGameFree().GetCreateRoomNum() > 0
|
||||
}
|
||||
|
||||
func (this *Scene) TryInviteRobot() {
|
||||
|
@ -1756,7 +1673,7 @@ func (this *Scene) TryInviteRobot() {
|
|||
return
|
||||
}
|
||||
// 游戏配置错误
|
||||
if this.DbGameFree == nil {
|
||||
if this.GetDBGameFree() == nil {
|
||||
return
|
||||
}
|
||||
// 私有房间不邀请机器人,比赛场部邀请机器人
|
||||
|
@ -1764,11 +1681,11 @@ func (this *Scene) TryInviteRobot() {
|
|||
return
|
||||
}
|
||||
// 队列匹配不邀请机器人
|
||||
if this.DbGameFree.GetMatchMode() == 1 {
|
||||
if this.GetDBGameFree().GetMatchMode() == 1 {
|
||||
return
|
||||
}
|
||||
// 不使用机器人
|
||||
if this.DbGameFree.GetBot() == 0 { //机器人不进的场
|
||||
if this.GetDBGameFree().GetBot() == 0 { //机器人不进的场
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -1782,7 +1699,7 @@ func (this *Scene) TryInviteRobot() {
|
|||
return
|
||||
}
|
||||
|
||||
switch this.DbGameFree.GetGameType() {
|
||||
switch this.GetDBGameFree().GetGameType() {
|
||||
case common.GameType_Fishing:
|
||||
if this.robotNum >= this.robotLimit {
|
||||
return
|
||||
|
@ -1818,8 +1735,8 @@ func (this *Scene) TryInviteRobot() {
|
|||
}
|
||||
hadCnt := len(this.Players)
|
||||
robCnt = this.robotLimit - this.robotNum
|
||||
if robCnt > this.playerNum-hadCnt {
|
||||
robCnt = this.playerNum - hadCnt
|
||||
if robCnt > this.GetPlayerNum()-hadCnt {
|
||||
robCnt = this.GetPlayerNum() - hadCnt
|
||||
}
|
||||
} else if this.IsHundredScene() {
|
||||
robCnt = this.robotLimit - this.robotNum
|
||||
|
@ -1830,7 +1747,7 @@ func (this *Scene) TryInviteRobot() {
|
|||
return
|
||||
}
|
||||
hadCnt := len(this.Players)
|
||||
robCnt = this.playerNum - hadCnt
|
||||
robCnt = this.GetPlayerNum() - hadCnt
|
||||
if this.realPlayerNum == 0 { //一个真人都没有,不让机器人坐满房间
|
||||
robCnt--
|
||||
}
|
||||
|
@ -1838,7 +1755,7 @@ func (this *Scene) TryInviteRobot() {
|
|||
}
|
||||
if robCnt > 0 {
|
||||
var num int32
|
||||
if this.DbGameFree.GameId == common.GameId_ChesstitiansCambodianRobot {
|
||||
if this.GetDBGameFree().GameId == common.GameId_ChesstitiansCambodianRobot {
|
||||
num = int32(robCnt)
|
||||
} else {
|
||||
num = this.Rand.Int31n(int32(robCnt + 1))
|
||||
|
@ -1847,11 +1764,11 @@ func (this *Scene) TryInviteRobot() {
|
|||
if this.IsCoinScene() /* && this.gaming*/ { //如果牌局正在进行中,一个一个进
|
||||
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 {
|
||||
if this.DbGameFree == nil {
|
||||
if this.GetDBGameFree() == nil {
|
||||
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 false
|
||||
|
@ -1915,7 +1832,7 @@ func (this *Scene) RobotLeaveHundred() {
|
|||
//钱多
|
||||
leave = true
|
||||
reason = common.PlayerLeaveReason_Normal
|
||||
} else if p.Coin < int64(this.DbGameFree.GetBetLimit()) {
|
||||
} else if p.Coin < int64(this.GetDBGameFree().GetBetLimit()) {
|
||||
//少于下注限额
|
||||
leave = true
|
||||
reason = common.PlayerLeaveReason_Normal
|
||||
|
@ -1975,7 +1892,7 @@ func (this *Scene) GetRecordId() string {
|
|||
|
||||
func (this *Scene) RandTakeCoin(p *Player) (takeCoin, leaveCoin, gameTimes int64) {
|
||||
if p.IsRob && p.IsLocal {
|
||||
dbGameFree := this.DbGameFree
|
||||
dbGameFree := this.GetDBGameFree()
|
||||
takerng := dbGameFree.GetRobotTakeCoin()
|
||||
if len(takerng) >= 2 && takerng[1] > takerng[0] {
|
||||
if takerng[0] < dbGameFree.GetLimitCoin() {
|
||||
|
@ -2014,8 +1931,8 @@ func (this *Scene) TryBillExGameDrop(p *Player) {
|
|||
|
||||
this.DropCollectBox(p)
|
||||
|
||||
baseScore := this.DbGameFree.BaseScore
|
||||
if common.IsLocalGame(this.GameId) {
|
||||
baseScore := this.GetDBGameFree().BaseScore
|
||||
if common.IsLocalGame(int(this.GameId)) {
|
||||
baseScore = this.BaseScore
|
||||
}
|
||||
if baseScore == 0 {
|
||||
|
@ -2023,7 +1940,7 @@ func (this *Scene) TryBillExGameDrop(p *Player) {
|
|||
}
|
||||
|
||||
// 场次掉落开关
|
||||
if this.DbGameFree.IsDrop != 1 {
|
||||
if this.GetDBGameFree().IsDrop != 1 {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -2288,7 +2205,7 @@ func (this *Scene) Statistics(param *StaticParam) {
|
|||
return
|
||||
}
|
||||
|
||||
_, isNovice := p.NoviceOdds(this.GameId)
|
||||
_, isNovice := p.NoviceOdds(int(this.GameId))
|
||||
isControl := this.IsControl(param.HasRobotGaming) // 需要调控的房间
|
||||
|
||||
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 {
|
||||
keyNoviceGameId := common.GetKeyNoviceGameId(this.GameId)
|
||||
if !model.GameParamData.CloseNovice && !common.InSliceInt(model.GameParamData.CloseNoviceGame, int(this.GameId)) && isControl && wbLevel == 0 && isNovice {
|
||||
keyNoviceGameId := common.GetKeyNoviceGameId(int(this.GameId))
|
||||
var gs *model.PlayerGameStatics
|
||||
if data, ok := p.GDatas[keyNoviceGameId]; ok {
|
||||
statics = append(statics, &data.Statics)
|
||||
|
@ -2474,7 +2391,7 @@ func (this *Scene) Statistics(param *StaticParam) {
|
|||
}
|
||||
p.WinCoin += totalOut
|
||||
p.TaxCoin += param.GainTax
|
||||
if isPlayerPool && srvdata.GameFreeMgr.IsPlayerPool(this.GameId) {
|
||||
if isPlayerPool && srvdata.GameFreeMgr.IsPlayerPool(int(this.GameId)) {
|
||||
p.TotalOut += totalOut
|
||||
p.PlayerTax += param.GainTax
|
||||
}
|
||||
|
@ -2483,7 +2400,7 @@ func (this *Scene) Statistics(param *StaticParam) {
|
|||
p.FailTimes++
|
||||
}
|
||||
p.FailCoin += totalIn
|
||||
if isPlayerPool && srvdata.GameFreeMgr.IsPlayerPool(this.GameId) {
|
||||
if isPlayerPool && srvdata.GameFreeMgr.IsPlayerPool(int(this.GameId)) {
|
||||
p.TotalIn += totalIn
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -32,38 +32,47 @@ func (this *SceneMgr) makeKey(gameid, gamemode int) int {
|
|||
return int(gameid*10000 + gamemode)
|
||||
}
|
||||
|
||||
func (this *SceneMgr) CreateScene(s *netlib.Session, sceneId, gameMode, sceneMode, gameId int, platform string,
|
||||
params []int64, agentor, creator int32, replayCode string, hallId, groupId, totalOfGames int32,
|
||||
dbGameFree *server.DB_GameFree, bEnterAfterStart bool, baseScore int32, playerNum int, chessRank []int32) *Scene {
|
||||
scene := NewScene(s, sceneId, gameMode, sceneMode, gameId, platform, params, agentor, creator, replayCode,
|
||||
hallId, groupId, totalOfGames, dbGameFree, bEnterAfterStart, baseScore, playerNum, chessRank)
|
||||
type CreateSceneParam struct {
|
||||
Session *netlib.Session
|
||||
*server.WGCreateScene
|
||||
}
|
||||
|
||||
func (this *SceneMgr) CreateScene(args *CreateSceneParam) *Scene {
|
||||
scene := NewScene(args)
|
||||
if scene == nil {
|
||||
logger.Logger.Error("(this *SceneMgr) CreateScene, scene == 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 {
|
||||
this.PlatformScene[platform] = true
|
||||
}
|
||||
//
|
||||
key := this.makeKey(gameId, gameMode)
|
||||
// 游戏id索引
|
||||
key := this.makeKey(int(gameId), int(gameMode))
|
||||
if ss, exist := this.scenesByGame[key]; exist {
|
||||
ss[scene.SceneId] = scene
|
||||
ss[int(scene.SceneId)] = scene
|
||||
} else {
|
||||
ss = make(map[int]*Scene)
|
||||
ss[scene.SceneId] = scene
|
||||
ss[int(scene.SceneId)] = scene
|
||||
this.scenesByGame[key] = ss
|
||||
}
|
||||
//
|
||||
if ss, exist := this.scenesByGameFree[dbGameFree.GetId()]; exist {
|
||||
ss[scene.SceneId] = scene
|
||||
// 场次id索引
|
||||
if ss, exist := this.scenesByGameFree[gameFreeId]; exist {
|
||||
ss[int(scene.SceneId)] = scene
|
||||
} else {
|
||||
ss = make(map[int]*Scene)
|
||||
ss[scene.SceneId] = scene
|
||||
this.scenesByGameFree[dbGameFree.GetId()] = ss
|
||||
ss[int(scene.SceneId)] = scene
|
||||
this.scenesByGameFree[gameFreeId] = ss
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -71,13 +80,13 @@ func (this *SceneMgr) DestroyScene(sceneId int) {
|
|||
if scene, exist := this.scenes[sceneId]; exist {
|
||||
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 {
|
||||
delete(ss, scene.SceneId)
|
||||
delete(ss, int(scene.SceneId))
|
||||
}
|
||||
//
|
||||
if ss, exist := this.scenesByGameFree[scene.GetGameFreeId()]; exist {
|
||||
delete(ss, scene.SceneId)
|
||||
delete(ss, int(scene.SceneId))
|
||||
}
|
||||
delete(this.scenes, 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)
|
||||
if val > 0 {
|
||||
jpfi := &gamehall.GameJackpotFundInfo{
|
||||
GameFreeId: proto.Int32(s.DbGameFree.Id),
|
||||
GameFreeId: proto.Int32(s.GetGameFreeId()),
|
||||
JackPotFund: proto.Int64(val),
|
||||
}
|
||||
pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi)
|
||||
|
|
|
@ -59,14 +59,14 @@ func (this *CaiShenSceneData) SceneDestroy(force bool) {
|
|||
}
|
||||
|
||||
func (this *CaiShenSceneData) init() bool {
|
||||
if this.DbGameFree == nil {
|
||||
if this.GetDBGameFree() == nil {
|
||||
return false
|
||||
}
|
||||
params := this.DbGameFree.GetJackpot()
|
||||
params := this.GetDBGameFree().GetJackpot()
|
||||
this.jackpot = &base.SlotJackpotPool{}
|
||||
if 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)
|
||||
if str != "" {
|
||||
|
@ -102,7 +102,7 @@ type CaiShenSpinResult struct {
|
|||
}
|
||||
|
||||
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 {
|
||||
newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0)
|
||||
if taxScore != nil {
|
||||
|
@ -188,7 +188,7 @@ func (this *CaiShenSceneData) BroadcastJackpot(sync bool) {
|
|||
this.lastJackpotValue = this.jackpot.VirtualJK
|
||||
pack := &gamehall.SCHundredSceneGetGameJackpot{}
|
||||
jpfi := &gamehall.GameJackpotFundInfo{
|
||||
GameFreeId: proto.Int32(this.DbGameFree.Id),
|
||||
GameFreeId: proto.Int32(this.GetDBGameFree().Id),
|
||||
JackPotFund: proto.Int64(this.jackpot.VirtualJK),
|
||||
}
|
||||
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) {
|
||||
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{} {
|
||||
return model.InsertBurstJackpotLogs(log)
|
||||
}), nil, "InsertBurstJackpotLogs").Start()
|
||||
|
@ -223,7 +223,7 @@ func (this *CaiShenSceneData) RecordBurstLog(name string, wincoin, totalbet int6
|
|||
|
||||
func (this *CaiShenSceneData) BurstHistory(player *CaiShenPlayerData) {
|
||||
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) {
|
||||
var logsp []*caishen.CaiShenBurstHistoryInfo
|
||||
if data != nil {
|
||||
|
@ -251,7 +251,7 @@ func (this *CaiShenSceneData) GetLastBurstJackPot() time.Time {
|
|||
}
|
||||
func (this *CaiShenSceneData) SetLastBurstJackPot() {
|
||||
var randT = rand.Intn(25200-7200+1) + 7200
|
||||
switch this.DbGameFree.SceneType {
|
||||
switch this.GetDBGameFree().SceneType {
|
||||
case 1:
|
||||
randT = rand.Intn(25200-7200+1) + 7200
|
||||
case 2:
|
||||
|
@ -267,7 +267,7 @@ func (this *CaiShenSceneData) SetLastBurstJackPot() {
|
|||
func (this *CaiShenSceneData) AIAddJackPot() {
|
||||
if time.Now().Sub(this.lastJackPot) > 0 {
|
||||
var randT = rand.Intn(3) + 1
|
||||
switch this.DbGameFree.SceneType {
|
||||
switch this.GetDBGameFree().SceneType {
|
||||
case 1:
|
||||
randT = rand.Intn(3) + 1
|
||||
case 2:
|
||||
|
@ -280,20 +280,20 @@ func (this *CaiShenSceneData) AIAddJackPot() {
|
|||
randT = rand.Intn(3) + 1
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
func (this *CaiShenSceneData) AIBurstJackPot() {
|
||||
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
|
||||
this.SetLastBurstJackPot()
|
||||
jackpotParams := this.DbGameFree.GetJackpot()
|
||||
var jackpotInit = int64(jackpotParams[rule.CAISHEN_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) //奖池初始值
|
||||
jackpotParams := this.GetDBGameFree().GetJackpot()
|
||||
var jackpotInit = int64(jackpotParams[rule.CAISHEN_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) //奖池初始值
|
||||
|
||||
//AI机器人爆奖
|
||||
val := this.jackpot.VirtualJK
|
||||
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))
|
||||
}
|
||||
}
|
||||
|
@ -314,11 +314,11 @@ func (this *CaiShenSceneData) KickPlayerByTime() {
|
|||
}
|
||||
//for _, p := range this.players {
|
||||
// //游戏次数达到目标值
|
||||
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId()))
|
||||
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.GetDBGameFree().GetId()))
|
||||
// if !p.IsRob &&
|
||||
// todayGamefreeIDSceneData != nil &&
|
||||
// this.DbGameFree.GetPlayNumLimit() != 0 &&
|
||||
// todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) {
|
||||
// this.GetDBGameFree().GetPlayNumLimit() != 0 &&
|
||||
// todayGamefreeIDSceneData.GameTimes >= int64(this.GetDBGameFree().GetPlayNumLimit()) {
|
||||
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -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)
|
||||
if sceneEx, ok := s.ExtraData.(*CaiShenSceneData); ok {
|
||||
playerEx := &CaiShenPlayerData{Player: p}
|
||||
playerEx.init(s) // 玩家当前信息初始化
|
||||
playerEx.score = sceneEx.DbGameFree.GetBaseScore() // 底注
|
||||
playerEx.init(s) // 玩家当前信息初始化
|
||||
playerEx.score = sceneEx.GetDBGameFree().GetBaseScore() // 底注
|
||||
sceneEx.players[p.SnId] = playerEx
|
||||
p.ExtraData = playerEx
|
||||
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) {
|
||||
logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId)
|
||||
pack := &caishen.SCCaiShenRoomInfo{
|
||||
RoomId: proto.Int(s.SceneId),
|
||||
RoomId: s.SceneId,
|
||||
Creator: proto.Int32(s.Creator),
|
||||
GameId: proto.Int(s.GameId),
|
||||
RoomMode: proto.Int(s.GameMode),
|
||||
GameId: s.GameId,
|
||||
RoomMode: s.GameMode,
|
||||
Params: common.CopySliceInt64ToInt32(s.Params),
|
||||
State: proto.Int(s.SceneState.GetState()),
|
||||
Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK),
|
||||
GameFreeId: proto.Int32(s.DbGameFree.Id),
|
||||
GameFreeId: proto.Int32(s.GetDBGameFree().Id),
|
||||
BilledData: data,
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,7 @@ func CaiShenSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *CaiShenSceneDat
|
|||
//}
|
||||
pack.BetLines = playerEx.betLines
|
||||
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)
|
||||
if playerEx.totalPriceBonus > 0 {
|
||||
switch playerEx.bonusStage {
|
||||
|
@ -373,7 +373,7 @@ func (this *SceneStateCaiShenStart) OnPlayerOp(s *base.Scene, p *base.Player, op
|
|||
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)
|
||||
return false
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ func (this *SceneStateCaiShenStart) OnPlayerOp(s *base.Scene, p *base.Player, op
|
|||
if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin {
|
||||
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, caishen.OpResultCode_OPRC_CoinNotEnough, params)
|
||||
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)
|
||||
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)
|
||||
|
||||
//税收比例
|
||||
taxRate := sceneEx.DbGameFree.GetTaxRate()
|
||||
taxRate := sceneEx.GetDBGameFree().GetTaxRate()
|
||||
if taxRate < 0 || taxRate > 10000 {
|
||||
logger.Logger.Tracef("CaiShenErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate)
|
||||
taxRate = 500
|
||||
|
@ -445,8 +445,8 @@ func (this *SceneStateCaiShenStart) OnPlayerOp(s *base.Scene, p *base.Player, op
|
|||
prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额
|
||||
|
||||
// 奖池参数
|
||||
var jackpotParam = sceneEx.DbGameFree.GetJackpot()
|
||||
var jackpotInit = int64(jackpotParam[rule.CAISHEN_JACKPOT_InitJackpot]) * int64(sceneEx.DbGameFree.GetBaseScore()) //奖池初始值
|
||||
var jackpotParam = sceneEx.GetDBGameFree().GetJackpot()
|
||||
var jackpotInit = int64(jackpotParam[rule.CAISHEN_JACKPOT_InitJackpot]) * int64(sceneEx.GetDBGameFree().GetBaseScore()) //奖池初始值
|
||||
|
||||
var jackpotFundAdd, prizeFundAdd int64
|
||||
if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注
|
||||
|
@ -466,7 +466,7 @@ func (this *SceneStateCaiShenStart) OnPlayerOp(s *base.Scene, p *base.Player, op
|
|||
////统计参与游戏次数
|
||||
//if !sceneEx.Testing && !playerEx.IsRob {
|
||||
// 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)}},
|
||||
// }
|
||||
// proto.SetDefaults(pack)
|
||||
|
@ -656,7 +656,7 @@ func (this *SceneStateCaiShenStart) OnPlayerOp(s *base.Scene, p *base.Player, op
|
|||
case CaiShenPlayerHistory:
|
||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||
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{}
|
||||
for _, v := range gpl.Data {
|
||||
//if v.GameDetailedLogId == "" {
|
||||
|
@ -847,7 +847,7 @@ func (this *SceneStateCaiShenStart) WinTargetBenchTest(s *base.Scene, p *base.Pl
|
|||
}
|
||||
file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,中线倍数,中线数,剩余免费次数\r\n")
|
||||
oldCoin := p.Coin
|
||||
switch s.DbGameFree.GetSceneType() {
|
||||
switch s.GetDBGameFree().GetSceneType() {
|
||||
case 1:
|
||||
p.Coin = 100000
|
||||
case 2:
|
||||
|
@ -905,7 +905,7 @@ func (this *SceneStateCaiShenStart) MultiplayerBenchTest(s *base.Scene) {
|
|||
})
|
||||
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)
|
||||
defer file.Close()
|
||||
if err != nil {
|
||||
|
@ -918,7 +918,7 @@ func (this *SceneStateCaiShenStart) MultiplayerBenchTest(s *base.Scene) {
|
|||
|
||||
playersFile := make(map[int32]*os.File)
|
||||
oldCoins := make(map[int32]int64)
|
||||
hasCoin := 1000 * int64(s.DbGameFree.GetBaseScore())
|
||||
hasCoin := 1000 * int64(s.GetDBGameFree().GetBaseScore())
|
||||
robots := make(map[int32]bool)
|
||||
testPlayers := make(map[int32]*base.Player)
|
||||
for _, p := range s.Players {
|
||||
|
@ -926,7 +926,7 @@ func (this *SceneStateCaiShenStart) MultiplayerBenchTest(s *base.Scene) {
|
|||
p.IsRob = false
|
||||
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)
|
||||
if err != nil {
|
||||
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 snid, p := range testPlayers {
|
||||
if playerEx, ok := p.ExtraData.(*CaiShenPlayerData); ok {
|
||||
|
@ -970,7 +970,7 @@ func (this *SceneStateCaiShenStart) MultiplayerBenchTest(s *base.Scene) {
|
|||
inCoin := int64(playerEx.RollGameType.BaseResult.TotalBet)
|
||||
outCoin := playerEx.RollGameType.BaseResult.ChangeCoin + inCoin
|
||||
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)
|
||||
|
||||
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
|
||||
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.AfterCoin = playerEx.Coin
|
||||
playerEx.RollGameType.BaseResult.BeforeCoin = startCoin
|
||||
|
@ -1063,8 +1063,8 @@ func CaiShenCheckAndSaveLog(sceneEx *CaiShenSceneData, playerEx *CaiShenPlayerDa
|
|||
GameCoinTs: proto.Int64(playerEx.GameCoinTs),
|
||||
}
|
||||
gwPlayerBet := &server.GWPlayerData{
|
||||
SceneId: proto.Int(sceneEx.SceneId),
|
||||
GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()),
|
||||
SceneId: sceneEx.SceneId,
|
||||
GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
|
||||
}
|
||||
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
|
||||
sceneEx.SyncPlayerDatas(&base.PlayerDataParam{
|
||||
|
|
|
@ -53,7 +53,7 @@ func getChessVariant(gameId int) int {
|
|||
}
|
||||
|
||||
func NewSceneEx(s *base.Scene) *SceneEx {
|
||||
variant := getChessVariant(s.GameId)
|
||||
variant := getChessVariant(int(s.GameId))
|
||||
chess := rule.NewChess(variant)
|
||||
chess.Init()
|
||||
sceneEx := &SceneEx{
|
||||
|
|
|
@ -485,7 +485,7 @@ func CreateRoomInfoPacket(s *base.Scene, p *base.Player, sceneEx *SceneEx, playe
|
|||
State: proto.Int32(int32(s.GetSceneState().GetState())),
|
||||
TimeOut: proto.Int(s.GetSceneState().GetTimeout(s)),
|
||||
NumOfGames: proto.Int(sceneEx.NumOfGames),
|
||||
TotalOfGames: proto.Int(sceneEx.TotalOfGames),
|
||||
TotalOfGames: sceneEx.TotalOfGames,
|
||||
CurOpIdx: proto.Int(-1),
|
||||
MasterSnid: proto.Int32(sceneEx.masterSnId),
|
||||
AudienceNum: proto.Int(s.GetAudiencesNum()),
|
||||
|
@ -528,7 +528,7 @@ func CreateRoomInfoPacket(s *base.Scene, p *base.Player, sceneEx *SceneEx, playe
|
|||
|
||||
}
|
||||
pack.MatchFinals = 0
|
||||
if s.MatchFinals {
|
||||
if s.GetMatch().GetIsFinals() {
|
||||
pack.MatchFinals = 1
|
||||
if s.NumOfGames >= 2 {
|
||||
pack.MatchFinals = 2
|
||||
|
@ -852,7 +852,7 @@ func (this *SceneStateWaitStart) OnTick(s *base.Scene) {
|
|||
if sceneEx, ok := s.GetExtraData().(*SceneEx); ok {
|
||||
if sceneEx.IsMatchScene() {
|
||||
delayT := time.Second * 2
|
||||
if sceneEx.MatchRound != 1 { //第一轮延迟2s,其他延迟3s 配合客户端播放动画
|
||||
if sceneEx.GetMatch().GetCurrRound() != 1 { //第一轮延迟2s,其他延迟3s 配合客户端播放动画
|
||||
delayT = time.Second * 4
|
||||
}
|
||||
if time.Now().Sub(sceneEx.StateStartTime) > delayT {
|
||||
|
@ -1215,14 +1215,14 @@ func (this *SceneStateBilled) OnEnter(s *base.Scene) {
|
|||
|
||||
pack := &chesstitians.SCChesstitiansGameBilled{}
|
||||
chessType := model.ChesstitiansType{
|
||||
GameId: sceneEx.GameId,
|
||||
GameId: int(sceneEx.GameId),
|
||||
RoomId: int32(sceneEx.GetSceneId()),
|
||||
RoomType: int32(sceneEx.Scene.SceneType),
|
||||
RoomType: sceneEx.Scene.GetDBGameFree().GetSceneType(),
|
||||
NumOfGames: int32(sceneEx.Scene.NumOfGames),
|
||||
BankId: sceneEx.masterSnId,
|
||||
PlayerCount: rule.MaxNumOfPlayer,
|
||||
BaseScore: s.BaseScore,
|
||||
TaxRate: s.DbGameFree.GetTaxRate(),
|
||||
TaxRate: s.GetDBGameFree().GetTaxRate(),
|
||||
RoomMode: s.GetSceneMode(),
|
||||
}
|
||||
|
||||
|
@ -1462,7 +1462,7 @@ func (this *SceneStateBilled) OnLeave(s *base.Scene) {
|
|||
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)
|
||||
}
|
||||
s.TryRelease()
|
||||
|
|
|
@ -53,14 +53,14 @@ func (this *EasterIslandSceneData) OnPlayerLeave(p *base.Player, reason int) {
|
|||
}
|
||||
|
||||
func (this *EasterIslandSceneData) init() bool {
|
||||
if this.DbGameFree == nil {
|
||||
if this.GetDBGameFree() == nil {
|
||||
return false
|
||||
}
|
||||
params := this.DbGameFree.GetJackpot()
|
||||
params := this.GetDBGameFree().GetJackpot()
|
||||
this.jackpot = &base.SlotJackpotPool{}
|
||||
if 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)
|
||||
if str != "" {
|
||||
|
@ -101,7 +101,7 @@ type EasterIslandSpinResult struct {
|
|||
}
|
||||
|
||||
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 {
|
||||
newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0)
|
||||
if taxScore != nil {
|
||||
|
@ -192,7 +192,7 @@ func (this *EasterIslandSceneData) BroadcastJackpot(sync bool) {
|
|||
this.lastJackpotValue = this.jackpot.VirtualJK
|
||||
pack := &gamehall.SCHundredSceneGetGameJackpot{}
|
||||
jpfi := &gamehall.GameJackpotFundInfo{
|
||||
GameFreeId: proto.Int32(this.DbGameFree.Id),
|
||||
GameFreeId: proto.Int32(this.GetDBGameFree().Id),
|
||||
JackPotFund: proto.Int64(this.jackpot.VirtualJK),
|
||||
}
|
||||
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) {
|
||||
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{} {
|
||||
return model.InsertBurstJackpotLogs(log)
|
||||
}), nil, "InsertBurstJackpotLogs").Start()
|
||||
|
@ -226,7 +226,7 @@ func (this *EasterIslandSceneData) RecordBurstLog(name string, wincoin, totalbet
|
|||
|
||||
func (this *EasterIslandSceneData) BurstHistory(player *EasterIslandPlayerData) {
|
||||
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) {
|
||||
var logsp []*easterisland.EasterIslandBurstHistoryInfo
|
||||
if data != nil {
|
||||
|
@ -254,7 +254,7 @@ func (this *EasterIslandSceneData) GetLastBurstJackPot() time.Time {
|
|||
}
|
||||
func (this *EasterIslandSceneData) SetLastBurstJackPot() {
|
||||
var randT = rand.Intn(25200-7200+1) + 7200
|
||||
switch this.DbGameFree.SceneType {
|
||||
switch this.GetDBGameFree().SceneType {
|
||||
case 1:
|
||||
randT = rand.Intn(25200-7200+1) + 7200
|
||||
case 2:
|
||||
|
@ -269,7 +269,7 @@ func (this *EasterIslandSceneData) SetLastBurstJackPot() {
|
|||
func (this *EasterIslandSceneData) AIAddJackPot() {
|
||||
if time.Now().Sub(this.lastJackPot) > 0 {
|
||||
var randT = rand.Intn(3) + 1
|
||||
switch this.DbGameFree.SceneType {
|
||||
switch this.GetDBGameFree().SceneType {
|
||||
case 1:
|
||||
randT = rand.Intn(3) + 1
|
||||
case 2:
|
||||
|
@ -282,20 +282,20 @@ func (this *EasterIslandSceneData) AIAddJackPot() {
|
|||
randT = rand.Intn(3) + 1
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
func (this *EasterIslandSceneData) AIBurstJackPot() {
|
||||
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
|
||||
this.SetLastBurstJackPot()
|
||||
jackpotParams := this.DbGameFree.GetJackpot()
|
||||
var jackpotInit = int64(jackpotParams[rule.EL_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) //奖池初始值
|
||||
jackpotParams := this.GetDBGameFree().GetJackpot()
|
||||
var jackpotInit = int64(jackpotParams[rule.EL_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) //奖池初始值
|
||||
|
||||
//AI机器人爆奖
|
||||
val := this.jackpot.VirtualJK
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
@ -316,11 +316,11 @@ func (this *EasterIslandSceneData) KickPlayerByTime() {
|
|||
}
|
||||
//for _, p := range this.players {
|
||||
// //游戏次数达到目标值
|
||||
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId()))
|
||||
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.GetDBGameFree().GetId()))
|
||||
// if !p.IsRob &&
|
||||
// todayGamefreeIDSceneData != nil &&
|
||||
// this.DbGameFree.GetPlayNumLimit() != 0 &&
|
||||
// todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) {
|
||||
// this.GetDBGameFree().GetPlayNumLimit() != 0 &&
|
||||
// todayGamefreeIDSceneData.GameTimes >= int64(this.GetDBGameFree().GetPlayNumLimit()) {
|
||||
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -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)
|
||||
if sceneEx, ok := s.ExtraData.(*EasterIslandSceneData); ok {
|
||||
playerEx := &EasterIslandPlayerData{Player: p}
|
||||
playerEx.init(s) // 玩家当前信息初始化
|
||||
playerEx.score = sceneEx.DbGameFree.GetBaseScore() // 底注
|
||||
playerEx.init(s) // 玩家当前信息初始化
|
||||
playerEx.score = sceneEx.GetDBGameFree().GetBaseScore() // 底注
|
||||
sceneEx.players[p.SnId] = playerEx
|
||||
p.ExtraData = playerEx
|
||||
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) {
|
||||
logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId)
|
||||
pack := &easterisland.SCEasterIslandRoomInfo{
|
||||
RoomId: proto.Int(s.SceneId),
|
||||
RoomId: s.SceneId,
|
||||
Creator: proto.Int32(s.Creator),
|
||||
GameId: proto.Int(s.GameId),
|
||||
RoomMode: proto.Int(s.GameMode),
|
||||
GameId: s.GameId,
|
||||
RoomMode: s.GameMode,
|
||||
Params: common.CopySliceInt64ToInt32(s.Params),
|
||||
State: proto.Int(s.SceneState.GetState()),
|
||||
Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK),
|
||||
GameFreeId: proto.Int32(s.DbGameFree.Id),
|
||||
GameFreeId: proto.Int32(s.GetDBGameFree().Id),
|
||||
BilledData: data,
|
||||
}
|
||||
if playerEx != nil {
|
||||
|
@ -256,7 +256,7 @@ func EasterIslandSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *EasterIsla
|
|||
//}
|
||||
pack.BetLines = playerEx.betLines
|
||||
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)
|
||||
if playerEx.totalPriceBonus > 0 {
|
||||
switch playerEx.bonusStage {
|
||||
|
@ -367,7 +367,7 @@ func (this *SceneStateEasterIslandStart) OnPlayerOp(s *base.Scene, p *base.Playe
|
|||
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)
|
||||
return false
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ func (this *SceneStateEasterIslandStart) OnPlayerOp(s *base.Scene, p *base.Playe
|
|||
if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin {
|
||||
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_CoinNotEnough, params)
|
||||
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)
|
||||
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)
|
||||
taxRate := sceneEx.DbGameFree.GetTaxRate()
|
||||
taxRate := sceneEx.GetDBGameFree().GetTaxRate()
|
||||
if taxRate < 0 || taxRate > 10000 {
|
||||
logger.Logger.Warnf("EasterIslandErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate)
|
||||
taxRate = 500
|
||||
|
@ -430,9 +430,9 @@ func (this *SceneStateEasterIslandStart) OnPlayerOp(s *base.Scene, p *base.Playe
|
|||
} else {
|
||||
gamePoolCoin = base.CoinPoolMgr.GetCoin(sceneEx.GetGameFreeId(), sceneEx.Platform, sceneEx.GroupId) // 当前水池金额
|
||||
}
|
||||
prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额
|
||||
jackpotParams := sceneEx.DbGameFree.GetJackpot() // 奖池参数
|
||||
var jackpotInit = int64(jackpotParams[rule.EL_JACKPOT_InitJackpot]) * int64(sceneEx.DbGameFree.GetBaseScore()) //奖池初始值
|
||||
prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额
|
||||
jackpotParams := sceneEx.GetDBGameFree().GetJackpot() // 奖池参数
|
||||
var jackpotInit = int64(jackpotParams[rule.EL_JACKPOT_InitJackpot]) * int64(sceneEx.GetDBGameFree().GetBaseScore()) //奖池初始值
|
||||
|
||||
var jackpotFundAdd, prizeFundAdd int64
|
||||
if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注
|
||||
|
@ -449,7 +449,7 @@ func (this *SceneStateEasterIslandStart) OnPlayerOp(s *base.Scene, p *base.Playe
|
|||
////统计参与游戏次数
|
||||
//if !sceneEx.Testing && !playerEx.IsRob {
|
||||
// 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)}},
|
||||
// }
|
||||
// proto.SetDefaults(pack)
|
||||
|
@ -629,7 +629,7 @@ func (this *SceneStateEasterIslandStart) OnPlayerOp(s *base.Scene, p *base.Playe
|
|||
case EasterIslandPlayerHistory:
|
||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||
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{}
|
||||
for _, v := range gpl.Data {
|
||||
//if v.GameDetailedLogId == "" {
|
||||
|
@ -819,7 +819,7 @@ func (this *SceneStateEasterIslandStart) WinTargetBenchTest(s *base.Scene, p *ba
|
|||
}
|
||||
file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,中线倍数,中线数,剩余免费次数\r\n")
|
||||
oldCoin := p.Coin
|
||||
switch s.DbGameFree.GetSceneType() {
|
||||
switch s.GetDBGameFree().GetSceneType() {
|
||||
case 1:
|
||||
p.Coin = 100000
|
||||
case 2:
|
||||
|
@ -873,7 +873,7 @@ func EasterIslandCheckAndSaveLog(sceneEx *EasterIslandSceneData, playerEx *Easte
|
|||
|
||||
//log2
|
||||
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.AfterCoin = playerEx.Coin
|
||||
playerEx.RollGameType.BaseResult.BeforeCoin = startCoin
|
||||
|
@ -932,8 +932,8 @@ func EasterIslandCheckAndSaveLog(sceneEx *EasterIslandSceneData, playerEx *Easte
|
|||
GameCoinTs: proto.Int64(playerEx.GameCoinTs),
|
||||
}
|
||||
gwPlayerBet := &server.GWPlayerData{
|
||||
SceneId: proto.Int(sceneEx.SceneId),
|
||||
GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()),
|
||||
SceneId: sceneEx.SceneId,
|
||||
GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
|
||||
}
|
||||
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
|
||||
sceneEx.SyncPlayerDatas(&base.PlayerDataParam{
|
||||
|
|
|
@ -406,7 +406,7 @@ func (this *CSFishSkillUseReqHandler) Process(s *netlib.Session, packetid int, d
|
|||
status := false
|
||||
for _, s := range strSlice {
|
||||
num, _ := strconv.Atoi(s)
|
||||
if num == player.GetScene().SceneType {
|
||||
if int32(num) == player.GetScene().GetSceneType() {
|
||||
status = true
|
||||
}
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ func (this *CSFishSkillUseReqHandler) Process(s *netlib.Session, packetid int, d
|
|||
pack.Result = 1
|
||||
pack.Status = fishing_proto.SCFishSkillUseResp_ROOM_DISALLOW
|
||||
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
|
||||
}
|
||||
//判断当前技能在不在CD中
|
||||
|
@ -516,7 +516,7 @@ func (this *CSSkillListReqHandler) Process(s *netlib.Session, packetid int, data
|
|||
pack := &fishing_proto.SCSkillListResp{}
|
||||
for _, skill := range srvdata.PBDB_FishSkillMgr.Datas.Arr {
|
||||
//获取房间类型
|
||||
sceneType := player.GetScene().SceneType
|
||||
sceneType := player.GetScene().GetSceneType()
|
||||
str := skill.Hidden
|
||||
num, err := strconv.Atoi(str)
|
||||
status := true
|
||||
|
|
|
@ -300,7 +300,7 @@ func (this *FishingPlayerData) SaveDetailedLog(s *base.Scene) {
|
|||
GameCoinTs: proto.Int64(this.GameCoinTs),
|
||||
}
|
||||
gwPlayerData := &server_proto.GWPlayerData{
|
||||
SceneId: proto.Int(sceneEx.SceneId),
|
||||
SceneId: sceneEx.SceneId,
|
||||
GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
|
||||
}
|
||||
gwPlayerData.Datas = append(gwPlayerData.Datas, playerBet)
|
||||
|
|
|
@ -108,7 +108,7 @@ func (this *FishingSceneData) init() bool {
|
|||
this.SetPlayerNum(4)
|
||||
this.gameId = this.GetGameId()
|
||||
this.platform = this.GetPlatform()
|
||||
this.sceneType = int(this.DbGameFree.GetSceneType())
|
||||
this.sceneType = int(this.GetDBGameFree().GetSceneType())
|
||||
this.keyGameId = this.GetKeyGameId()
|
||||
this.testing = this.GetTesting()
|
||||
this.gamefreeId = this.GetGameFreeId()
|
||||
|
@ -904,7 +904,7 @@ func (this *FishingSceneData) fishSettlements(fishs []*Fish, player *FishingPlay
|
|||
}
|
||||
//BOSS鱼死亡 更新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)
|
||||
}
|
||||
|
||||
|
@ -1507,7 +1507,7 @@ func (this *FishingSceneData) AddBossPond(player *FishingPlayerData, fishtype in
|
|||
// 减掉个人池数值
|
||||
if score > 0 {
|
||||
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
|
||||
}
|
||||
player.MoneyPond += minNum
|
||||
base.GetCoinPoolMgr().AddBossPond(this.DbGameFree.SceneType, -minNum)
|
||||
base.GetCoinPoolMgr().AddBossPond(this.GetDBGameFree().SceneType, -minNum)
|
||||
fishlogger.Infof("玩家:%v,Boss奖池剩余金币数量:%v\n", player.SnId, bossPond)
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ func (p *FruitsPlayerData) Clear() {
|
|||
p.weightPos = 0
|
||||
}
|
||||
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)
|
||||
// if p.testIdx == 1 {
|
||||
// //test mary
|
||||
|
@ -186,7 +186,7 @@ func (p *FruitsPlayerData) CreateResult(eleLineAppearRate [][]int32, sceneEx *Fr
|
|||
case 5:
|
||||
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
|
||||
break
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ func NewFruitsSceneData(s *base.Scene) *FruitsSceneData {
|
|||
func (s *FruitsSceneData) Init() {
|
||||
s.LoadJackPotData()
|
||||
//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.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) {
|
||||
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.AddServiceFee(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)
|
||||
logger.Logger.Tracef("奖池增加...AddPrizeCoin... %f", float64(addPrizeCoin)/float64(fruits.NowByte))
|
||||
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 {
|
||||
//SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, playerEx.winCoin)
|
||||
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.winCoin -= tax
|
||||
//p.AddServiceFee(tax)
|
||||
|
@ -140,7 +140,7 @@ func (s *FruitsSceneData) Win(p *FruitsPlayerData) {
|
|||
p.noWinTimes = 0
|
||||
//SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.winCoin)
|
||||
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.winCoin -= tax
|
||||
//p.AddServiceFee(tax)
|
||||
|
@ -210,7 +210,7 @@ func (s *FruitsSceneData) LoadJackPotData() {
|
|||
base.SlotsPoolMgr.SetPool(s.GetGameFreeId(), s.Platform, s.jackpot)
|
||||
} else {
|
||||
s.jackpot = &base.SlotJackpotPool{}
|
||||
jp := s.DbGameFree.GetJackpot()
|
||||
jp := s.GetDBGameFree().GetJackpot()
|
||||
if len(jp) > 0 {
|
||||
s.jackpot.Small += int64(jp[0] * 10000)
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ func (s *FruitsSceneData) SaveLog(p *FruitsPlayerData, isOffline int) {
|
|||
}
|
||||
}
|
||||
FruitsType := model.FruitsType{
|
||||
RoomId: s.SceneId,
|
||||
RoomId: int(s.SceneId),
|
||||
BasicScore: int32(p.oneBetCoin),
|
||||
PlayerSnId: p.SnId,
|
||||
BeforeCoin: p.startCoin,
|
||||
|
@ -372,7 +372,7 @@ func (s *FruitsSceneData) SendPlayerBet(p *FruitsPlayerData) {
|
|||
Tax: proto.Int64(p.taxCoin),
|
||||
}
|
||||
gwPlayerBet := &server.GWPlayerData{
|
||||
GameFreeId: proto.Int32(s.DbGameFree.GetId()),
|
||||
GameFreeId: proto.Int32(s.GetDBGameFree().GetId()),
|
||||
}
|
||||
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
|
||||
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 = int64(math.Floor(float64(curCoin) / float64(fruits.NowByte)))
|
||||
|
||||
for i := len(s.DbGameFree.BalanceLine) - 1; i >= 0; i-- {
|
||||
balance := s.DbGameFree.BalanceLine[i]
|
||||
for i := len(s.GetDBGameFree().BalanceLine) - 1; i >= 0; i-- {
|
||||
balance := s.GetDBGameFree().BalanceLine[i]
|
||||
if curCoin >= int64(balance) {
|
||||
key = int32(i)
|
||||
break
|
||||
|
|
|
@ -148,16 +148,16 @@ func FruitsSendRoomInfo(s *base.Scene, sceneEx *FruitsSceneData, playerEx *Fruit
|
|||
func FruitsCreateRoomInfoPacket(s *base.Scene, sceneEx *FruitsSceneData, playerEx *FruitsPlayerData) interface{} {
|
||||
//房间信息
|
||||
pack := &protocol.SCFruitsRoomInfo{
|
||||
RoomId: proto.Int(s.SceneId),
|
||||
GameId: proto.Int(s.GameId),
|
||||
RoomMode: proto.Int(s.SceneMode),
|
||||
SceneType: proto.Int(s.SceneType),
|
||||
RoomId: s.SceneId,
|
||||
GameId: s.GameId,
|
||||
RoomMode: s.SceneMode,
|
||||
SceneType: s.GetSceneType(),
|
||||
Params: common.CopySliceInt64ToInt32(s.Params),
|
||||
NumOfGames: proto.Int(sceneEx.NumOfGames),
|
||||
State: proto.Int(s.SceneState.GetState()),
|
||||
ParamsEx: s.DbGameFree.OtherIntParams,
|
||||
GameFreeId: proto.Int32(s.DbGameFree.Id),
|
||||
//BetLimit: s.DbGameFree.BetLimit,
|
||||
ParamsEx: s.GetDBGameFree().OtherIntParams,
|
||||
GameFreeId: proto.Int32(s.GetDBGameFree().Id),
|
||||
//BetLimit: s.GetDBGameFree().BetLimit,
|
||||
}
|
||||
|
||||
//自己的信息
|
||||
|
@ -299,11 +299,11 @@ func (this *SceneBaseStateFruits) OnTick(s *base.Scene) {
|
|||
if sceneEx, ok := s.ExtraData.(*FruitsSceneData); ok {
|
||||
//for _, p := range sceneEx.players {
|
||||
// //游戏次数达到目标值
|
||||
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(sceneEx.DbGameFree.GetId()))
|
||||
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(sceneEx.GetDBGameFree().GetId()))
|
||||
// if !p.IsRob &&
|
||||
// todayGamefreeIDSceneData != nil &&
|
||||
// sceneEx.DbGameFree.GetPlayNumLimit() != 0 &&
|
||||
// todayGamefreeIDSceneData.GameTimes >= int64(sceneEx.DbGameFree.GetPlayNumLimit()) {
|
||||
// sceneEx.GetDBGameFree().GetPlayNumLimit() != 0 &&
|
||||
// todayGamefreeIDSceneData.GameTimes >= int64(sceneEx.GetDBGameFree().GetPlayNumLimit()) {
|
||||
// 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()
|
||||
idx := int(params[0])
|
||||
if len(sceneEx.DbGameFree.GetOtherIntParams()) <= idx {
|
||||
if len(sceneEx.GetDBGameFree().GetOtherIntParams()) <= idx {
|
||||
pack := &protocol.SCFruitsOp{
|
||||
OpCode: proto.Int(opcode),
|
||||
OpRetCode: proto.Int(3),
|
||||
|
@ -419,12 +419,12 @@ func (this *SceneStateStartFruits) OnPlayerOp(s *base.Scene, p *base.Player, opc
|
|||
if playerEx.gameState == fruits.Normal {
|
||||
playerEx.freeTotal = 0
|
||||
playerEx.betIdx = idx
|
||||
playerEx.betCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[idx])
|
||||
playerEx.betCoin = int64(sceneEx.GetDBGameFree().GetOtherIntParams()[idx])
|
||||
playerEx.oneBetCoin = playerEx.betCoin / 9
|
||||
//playerEx.isReportGameEvent = true
|
||||
playerEx.noWinTimes++
|
||||
|
||||
if playerEx.Coin < int64(s.DbGameFree.GetBetLimit()) {
|
||||
if playerEx.Coin < int64(s.GetDBGameFree().GetBetLimit()) {
|
||||
//押注限制(低于该值不能押注)
|
||||
pack := &protocol.SCFruitsOp{
|
||||
OpCode: proto.Int(opcode),
|
||||
|
@ -486,9 +486,9 @@ func (this *SceneStateStartFruits) OnPlayerOp(s *base.Scene, p *base.Player, opc
|
|||
case fruits.FruitsPlayerOpSwitch:
|
||||
if len(params) > 0 && playerEx.freeTimes == 0 && playerEx.maryFreeTimes == 0 {
|
||||
idx := int(params[0])
|
||||
if len(sceneEx.DbGameFree.GetOtherIntParams()) > idx {
|
||||
if len(sceneEx.GetDBGameFree().GetOtherIntParams()) > idx {
|
||||
playerEx.betIdx = idx
|
||||
playerEx.betCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[idx])
|
||||
playerEx.betCoin = int64(sceneEx.GetDBGameFree().GetOtherIntParams()[idx])
|
||||
playerEx.oneBetCoin = playerEx.betCoin / 9
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ func (this *IceAgeSceneData) init() bool {
|
|||
this.jackpot = &base.SlotJackpotPool{}
|
||||
if 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())
|
||||
|
@ -238,7 +238,7 @@ func (this *IceAgeSceneData) BroadcastJackpot(sync bool) {
|
|||
this.lastJackpotValue = this.jackpot.VirtualJK
|
||||
pack := &gamehall.SCHundredSceneGetGameJackpot{}
|
||||
jpfi := &gamehall.GameJackpotFundInfo{
|
||||
GameFreeId: proto.Int32(this.DbGameFree.Id),
|
||||
GameFreeId: proto.Int32(this.GetDBGameFree().Id),
|
||||
JackPotFund: proto.Int64(this.jackpot.VirtualJK),
|
||||
}
|
||||
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) {
|
||||
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{} {
|
||||
return model.InsertBurstJackpotLogs(log)
|
||||
}), nil, "InsertBurstJackpotLogs").Start()
|
||||
|
@ -272,7 +272,7 @@ func (this *IceAgeSceneData) RecordBurstLog(name string, wincoin, totalbet int64
|
|||
|
||||
func (this *IceAgeSceneData) BurstHistory(player *IceAgePlayerData) {
|
||||
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) {
|
||||
var logsp []*iceage.IceAgeBurstHistoryInfo
|
||||
if data != nil {
|
||||
|
@ -300,7 +300,7 @@ func (this *IceAgeSceneData) GetLastBurstJackPot() time.Time {
|
|||
}
|
||||
func (this *IceAgeSceneData) SetLastBurstJackPot() {
|
||||
var randT = rand.Intn(25200-7200+1) + 7200
|
||||
switch this.DbGameFree.SceneType {
|
||||
switch this.GetDBGameFree().SceneType {
|
||||
case 1:
|
||||
randT = rand.Intn(25200-7200+1) + 7200
|
||||
case 2:
|
||||
|
@ -313,7 +313,7 @@ func (this *IceAgeSceneData) SetLastBurstJackPot() {
|
|||
func (this *IceAgeSceneData) AIAddJackPot() {
|
||||
if time.Now().Sub(this.lastJackPot) > 0 {
|
||||
var randT = rand.Intn(3) + 1
|
||||
switch this.DbGameFree.SceneType {
|
||||
switch this.GetDBGameFree().SceneType {
|
||||
case 1:
|
||||
randT = rand.Intn(3) + 1
|
||||
case 2:
|
||||
|
@ -324,20 +324,20 @@ func (this *IceAgeSceneData) AIAddJackPot() {
|
|||
randT = rand.Intn(3) + 1
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
func (this *IceAgeSceneData) AIBurstJackPot() {
|
||||
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
|
||||
this.SetLastBurstJackPot()
|
||||
jackpotParams := this.DbGameFree.GetJackpot()
|
||||
var jackpotInit = int64(jackpotParams[rule.ICEAGE_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) //奖池初始值
|
||||
jackpotParams := this.GetDBGameFree().GetJackpot()
|
||||
var jackpotInit = int64(jackpotParams[rule.ICEAGE_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) //奖池初始值
|
||||
|
||||
//AI机器人爆奖
|
||||
val := this.jackpot.VirtualJK
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
@ -358,11 +358,11 @@ func (this *IceAgeSceneData) KickPlayerByTime() {
|
|||
}
|
||||
//for _, p := range this.players {
|
||||
// //游戏次数达到目标值
|
||||
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId()))
|
||||
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.GetDBGameFree().GetId()))
|
||||
// if !p.IsRob &&
|
||||
// todayGamefreeIDSceneData != nil &&
|
||||
// this.DbGameFree.GetPlayNumLimit() != 0 &&
|
||||
// todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) {
|
||||
// this.GetDBGameFree().GetPlayNumLimit() != 0 &&
|
||||
// todayGamefreeIDSceneData.GameTimes >= int64(this.GetDBGameFree().GetPlayNumLimit()) {
|
||||
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -253,7 +253,7 @@ func IceAgeSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *IceAgeSceneData,
|
|||
pack.Players = append(pack.Players, pd)
|
||||
pack.BetLines = playerEx.betLines
|
||||
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.SpinID = proto.Int64(playerEx.spinID)
|
||||
}
|
||||
|
@ -681,7 +681,7 @@ func (this *SceneStateIceAgeStart) OnPlayerOp(s *base.Scene, p *base.Player, opc
|
|||
case IceAgePlayerHistory:
|
||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||
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{}
|
||||
for _, v := range gpl.Data {
|
||||
//if v.GameDetailedLogId == "" {
|
||||
|
@ -982,7 +982,7 @@ func IceAgeCheckAndSaveLog(sceneEx *IceAgeSceneData, playerEx *IceAgePlayerData)
|
|||
GameCoinTs: proto.Int64(playerEx.GameCoinTs),
|
||||
}
|
||||
gwPlayerBet := &server.GWPlayerData{
|
||||
SceneId: proto.Int(sceneEx.SceneId),
|
||||
SceneId: sceneEx.SceneId,
|
||||
GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
|
||||
}
|
||||
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
|
||||
|
|
|
@ -58,13 +58,13 @@ func (s *RichBlessedSceneData) SceneDestroy(force bool) {
|
|||
}
|
||||
func (s *RichBlessedSceneData) AddPrizeCoin(playerEx *RichBlessedPlayerData) {
|
||||
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.AddServiceFee(tax)
|
||||
val -= tax
|
||||
|
||||
addPrizeCoin := val * richblessed.NowByte * int64(s.DbGameFree.GetJackpotRatio()) //扩大10000倍
|
||||
jk1 := int64(math.Floor(float64(addPrizeCoin) / 1000 / 4)) //千分之奖池比例 分四份
|
||||
addPrizeCoin := val * richblessed.NowByte * int64(s.GetDBGameFree().GetJackpotRatio()) //扩大10000倍
|
||||
jk1 := int64(math.Floor(float64(addPrizeCoin) / 1000 / 4)) //千分之奖池比例 分四份
|
||||
s.jackpot.AddToGrand(playerEx.IsRob, jk1)
|
||||
s.jackpot.AddToBig(playerEx.IsRob, jk1)
|
||||
s.jackpot.AddToMiddle(playerEx.IsRob, jk1)
|
||||
|
@ -177,7 +177,7 @@ func (s *RichBlessedSceneData) Win(p *RichBlessedPlayerData) {
|
|||
p.noWinTimes = 0
|
||||
//SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.winCoin)
|
||||
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.winCoin -= tax
|
||||
//p.AddServiceFee(tax)
|
||||
|
@ -198,7 +198,7 @@ func (s *RichBlessedSceneData) JACKPOTWin(p *RichBlessedPlayerData) {
|
|||
p.noWinTimes = 0
|
||||
//SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.JackwinCoin)
|
||||
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.JackwinCoin -= tax
|
||||
//p.AddServiceFee(tax)
|
||||
|
@ -271,7 +271,7 @@ func (s *RichBlessedSceneData) LoadJackPotData() {
|
|||
base.SlotsPoolMgr.SetPool(s.GetGameFreeId(), s.Platform, s.jackpot)
|
||||
} else {
|
||||
s.jackpot = &base.SlotJackpotPool{}
|
||||
jp := s.DbGameFree.GetJackpot()
|
||||
jp := s.GetDBGameFree().GetJackpot()
|
||||
if len(jp) > 0 {
|
||||
s.jackpot.Small += int64(jp[0] * 10000)
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ func (s *RichBlessedSceneData) SaveLog(p *RichBlessedPlayerData, isOffline int)
|
|||
|
||||
}
|
||||
RichBlessed := model.RichBlessedType{
|
||||
RoomId: s.SceneId,
|
||||
RoomId: int(s.SceneId),
|
||||
BasicScore: int32(p.oneBetCoin),
|
||||
PlayerSnId: p.SnId,
|
||||
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 = int64(math.Floor(float64(curCoin) / float64(richblessed.NowByte)))
|
||||
|
||||
for i := len(s.DbGameFree.BalanceLine) - 1; i >= 0; i-- {
|
||||
balance := s.DbGameFree.BalanceLine[i]
|
||||
for i := len(s.GetDBGameFree().BalanceLine) - 1; i >= 0; i-- {
|
||||
balance := s.GetDBGameFree().BalanceLine[i]
|
||||
if curCoin >= int64(balance) {
|
||||
key = int32(i)
|
||||
break
|
||||
|
@ -426,7 +426,7 @@ func (s *RichBlessedSceneData) GetEleWeight(needpos int32) (norms, frees [][]int
|
|||
}
|
||||
|
||||
func (s *RichBlessedSceneData) CreateResult(eleLineAppearRate [][]int32, playerEx *RichBlessedPlayerData) {
|
||||
//if s.DbGameFree.GetId() == 3070004 {
|
||||
//if s.GetDBGameFree().GetId() == 3070004 {
|
||||
// playerEx.TestCode(eleLineAppearRate)
|
||||
//} else {
|
||||
playerEx.result.CreateLine(eleLineAppearRate)
|
||||
|
@ -448,7 +448,7 @@ func (s *RichBlessedSceneData) SendPlayerBet(p *RichBlessedPlayerData) {
|
|||
GameCoinTs: p.GameCoinTs,
|
||||
}
|
||||
gwPlayerBet := &server.GWPlayerData{
|
||||
GameFreeId: proto.Int32(s.DbGameFree.GetId()),
|
||||
GameFreeId: proto.Int32(s.GetDBGameFree().GetId()),
|
||||
SceneId: int32(s.SceneId),
|
||||
}
|
||||
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
|
||||
|
|
|
@ -71,7 +71,7 @@ func (this *ScenePolicyRichBlessed) OnPlayerEnter(s *base.Scene, p *base.Player)
|
|||
if s == nil || p == nil {
|
||||
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 {
|
||||
playerEx := &RichBlessedPlayerData{Player: p}
|
||||
playerEx.init()
|
||||
|
@ -148,15 +148,15 @@ func RichBlessedSendRoomInfo(s *base.Scene, sceneEx *RichBlessedSceneData, playe
|
|||
func RichBlessedCreateRoomInfoPacket(s *base.Scene, sceneEx *RichBlessedSceneData, playerEx *RichBlessedPlayerData) interface{} {
|
||||
//房间信息
|
||||
pack := &protocol.SCRBRoomInfo{
|
||||
RoomId: proto.Int(s.SceneId),
|
||||
GameId: proto.Int(s.GameId),
|
||||
RoomMode: proto.Int(s.SceneMode),
|
||||
SceneType: proto.Int(s.SceneType),
|
||||
RoomId: s.SceneId,
|
||||
GameId: s.GameId,
|
||||
RoomMode: s.SceneMode,
|
||||
SceneType: s.GetSceneType(),
|
||||
Params: common.CopySliceInt64ToInt32(s.Params),
|
||||
NumOfGames: proto.Int(sceneEx.NumOfGames),
|
||||
State: proto.Int(s.SceneState.GetState()),
|
||||
ParamsEx: common.Int64ToInt32(s.DbGameFree.OtherIntParams), //s.GetParamsEx(),
|
||||
//BetLimit: s.DbGameFree.BetLimit,
|
||||
ParamsEx: common.Int64ToInt32(s.GetDBGameFree().OtherIntParams), //s.GetParamsEx(),
|
||||
//BetLimit: s.GetDBGameFree().BetLimit,
|
||||
|
||||
NowGameState: proto.Int(playerEx.gameState),
|
||||
BetIdx: proto.Int(playerEx.betIdx),
|
||||
|
@ -172,11 +172,11 @@ func RichBlessedCreateRoomInfoPacket(s *base.Scene, sceneEx *RichBlessedSceneDat
|
|||
WinFreeTimes: proto.Int32(int32(playerEx.nowFreeTimes)),
|
||||
JackpotEle: proto.Int32(playerEx.result.JackpotEle),
|
||||
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显示
|
||||
oneBetCoin := int64(s.DbGameFree.GetOtherIntParams()[0] / richblessed.LineNum)
|
||||
if playerEx.oneBetCoin == 0 && len(s.GetDBGameFree().GetOtherIntParams()) != 0 { // 初始化客户端jack显示
|
||||
oneBetCoin := int64(s.GetDBGameFree().GetOtherIntParams()[0] / richblessed.LineNum)
|
||||
pack.SmallJackpot = oneBetCoin * richblessed.JkEleNumRate[richblessed.BlueGirl]
|
||||
pack.MiddleJackpot = oneBetCoin * richblessed.JkEleNumRate[richblessed.BlueBoy]
|
||||
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 {
|
||||
//for _, p := range sceneEx.players {
|
||||
// //游戏次数达到目标值
|
||||
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(sceneEx.DbGameFree.GetId()))
|
||||
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(sceneEx.GetDBGameFree().GetId()))
|
||||
// if !p.IsRob &&
|
||||
// todayGamefreeIDSceneData != nil &&
|
||||
// sceneEx.DbGameFree.GetPlayNumLimit() != 0 &&
|
||||
// todayGamefreeIDSceneData.GameTimes >= int64(sceneEx.DbGameFree.GetPlayNumLimit()) {
|
||||
// sceneEx.GetDBGameFree().GetPlayNumLimit() != 0 &&
|
||||
// todayGamefreeIDSceneData.GameTimes >= int64(sceneEx.GetDBGameFree().GetPlayNumLimit()) {
|
||||
// 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()
|
||||
idx := int(params[0])
|
||||
if len(sceneEx.DbGameFree.GetOtherIntParams()) <= idx {
|
||||
if len(sceneEx.GetDBGameFree().GetOtherIntParams()) <= idx {
|
||||
pack := &protocol.SCRichBlessedOp{
|
||||
OpCode: proto.Int(opcode),
|
||||
OpRetCode: proto.Int(3),
|
||||
|
@ -423,13 +423,13 @@ func (this *SceneStateStartRichBlessed) OnPlayerOp(s *base.Scene, p *base.Player
|
|||
if playerEx.gameState == richblessed.Normal {
|
||||
logger.Logger.Tracef("(this *SceneStateStartRichBlessed) OnPlayerOp, 下注 %v %v %v", playerEx.betCoin, playerEx.maxbetCoin, playerEx.oneBetCoin)
|
||||
playerEx.betIdx = idx
|
||||
playerEx.betCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[idx])
|
||||
maxidx := len(sceneEx.DbGameFree.GetOtherIntParams()) - 1
|
||||
playerEx.maxbetCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[maxidx])
|
||||
playerEx.betCoin = int64(sceneEx.GetDBGameFree().GetOtherIntParams()[idx])
|
||||
maxidx := len(sceneEx.GetDBGameFree().GetOtherIntParams()) - 1
|
||||
playerEx.maxbetCoin = int64(sceneEx.GetDBGameFree().GetOtherIntParams()[maxidx])
|
||||
playerEx.oneBetCoin = playerEx.betCoin / richblessed.LineNum // 单注
|
||||
playerEx.noWinTimes++
|
||||
|
||||
if playerEx.Coin < int64(s.DbGameFree.GetBetLimit()) {
|
||||
if playerEx.Coin < int64(s.GetDBGameFree().GetBetLimit()) {
|
||||
//押注限制(低于该值不能押注)
|
||||
pack := &protocol.SCRichBlessedOp{
|
||||
OpCode: proto.Int(opcode),
|
||||
|
@ -495,9 +495,9 @@ func (this *SceneStateStartRichBlessed) OnPlayerOp(s *base.Scene, p *base.Player
|
|||
case richblessed.RichBlessedPlayerOpSwitch:
|
||||
if len(params) > 0 && playerEx.freeTimes == 0 {
|
||||
idx := int(params[0])
|
||||
if len(sceneEx.DbGameFree.GetOtherIntParams()) > idx {
|
||||
if len(sceneEx.GetDBGameFree().GetOtherIntParams()) > idx {
|
||||
playerEx.betIdx = idx
|
||||
playerEx.betCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[idx])
|
||||
playerEx.betCoin = int64(sceneEx.GetDBGameFree().GetOtherIntParams()[idx])
|
||||
playerEx.oneBetCoin = playerEx.betCoin / richblessed.LineNum
|
||||
pack := &protocol.SCRichBlessedOp{
|
||||
OpCode: proto.Int(opcode),
|
||||
|
|
|
@ -271,15 +271,15 @@ func (this *SceneEx) init() bool {
|
|||
}
|
||||
|
||||
func (this *SceneEx) GetBaseScore() int32 { //游戏底分
|
||||
if this.DbGameFree != nil {
|
||||
return this.DbGameFree.GetBaseScore()
|
||||
if this.GetDBGameFree() != nil {
|
||||
return this.GetDBGameFree().GetBaseScore()
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
func (this *SceneEx) GetBetMaxCoin() int32 { //游戏底分
|
||||
if this.DbGameFree != nil {
|
||||
return this.DbGameFree.GetBaseScore() * 10000
|
||||
if this.GetDBGameFree() != nil {
|
||||
return this.GetDBGameFree().GetBaseScore() * 10000
|
||||
}
|
||||
return 1 * 10000
|
||||
}
|
||||
|
|
|
@ -52,14 +52,14 @@ func (this *TamQuocSceneData) SceneDestroy(force bool) {
|
|||
}
|
||||
|
||||
func (this *TamQuocSceneData) init() bool {
|
||||
if this.DbGameFree == nil {
|
||||
if this.GetDBGameFree() == nil {
|
||||
return false
|
||||
}
|
||||
params := this.DbGameFree.GetJackpot()
|
||||
params := this.GetDBGameFree().GetJackpot()
|
||||
this.jackpot = &base.SlotJackpotPool{}
|
||||
if 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)
|
||||
if str != "" {
|
||||
|
@ -95,7 +95,7 @@ type TamQuocSpinResult struct {
|
|||
}
|
||||
|
||||
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 {
|
||||
newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0)
|
||||
if taxScore != nil {
|
||||
|
@ -114,7 +114,7 @@ func (this *TamQuocSceneData) CalcLinePrize(cards []int, betLines []int64, betVa
|
|||
if spinRes.TotalPrizeJackpot == 0 { // 第一个爆奖 获取当前奖池所有
|
||||
prizeJackpot = this.jackpot.VirtualJK
|
||||
} 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)
|
||||
spinRes.TotalPrizeJackpot += prizeJackpot
|
||||
|
@ -177,7 +177,7 @@ func (this *TamQuocSceneData) BroadcastJackpot(sync bool) {
|
|||
this.lastJackpotValue = this.jackpot.VirtualJK
|
||||
pack := &gamehall.SCHundredSceneGetGameJackpot{}
|
||||
jpfi := &gamehall.GameJackpotFundInfo{
|
||||
GameFreeId: proto.Int32(this.DbGameFree.Id),
|
||||
GameFreeId: proto.Int32(this.GetDBGameFree().Id),
|
||||
JackPotFund: proto.Int64(this.jackpot.VirtualJK),
|
||||
}
|
||||
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) {
|
||||
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{} {
|
||||
return model.InsertBurstJackpotLogs(log)
|
||||
}), nil, "InsertBurstJackpotLogs").Start()
|
||||
|
@ -212,7 +212,7 @@ func (this *TamQuocSceneData) RecordBurstLog(name string, wincoin, totalbet int6
|
|||
|
||||
func (this *TamQuocSceneData) BurstHistory(player *TamQuocPlayerData) {
|
||||
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) {
|
||||
var logsp []*tamquoc.TamQuocBurstHistoryInfo
|
||||
if data != nil {
|
||||
|
@ -240,7 +240,7 @@ func (this *TamQuocSceneData) GetLastBurstJackPot() time.Time {
|
|||
}
|
||||
func (this *TamQuocSceneData) SetLastBurstJackPot() {
|
||||
var randT = rand.Intn(25200-7200+1) + 7200
|
||||
switch this.DbGameFree.SceneType {
|
||||
switch this.GetDBGameFree().SceneType {
|
||||
case 1:
|
||||
randT = rand.Intn(25200-7200+1) + 7200
|
||||
case 2:
|
||||
|
@ -254,7 +254,7 @@ func (this *TamQuocSceneData) SetLastBurstJackPot() {
|
|||
func (this *TamQuocSceneData) AIAddJackPot() {
|
||||
if time.Now().Sub(this.lastJackPot) > 0 {
|
||||
var randT = rand.Intn(3) + 1
|
||||
switch this.DbGameFree.SceneType {
|
||||
switch this.GetDBGameFree().SceneType {
|
||||
case 1:
|
||||
randT = rand.Intn(3) + 1
|
||||
case 2:
|
||||
|
@ -265,20 +265,20 @@ func (this *TamQuocSceneData) AIAddJackPot() {
|
|||
randT = rand.Intn(3) + 1
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
func (this *TamQuocSceneData) AIBurstJackPot() {
|
||||
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
|
||||
this.SetLastBurstJackPot()
|
||||
jackpotParams := this.DbGameFree.GetJackpot()
|
||||
var jackpotInit = int64(jackpotParams[rule.TAMQUOC_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) //奖池初始值
|
||||
jackpotParams := this.GetDBGameFree().GetJackpot()
|
||||
var jackpotInit = int64(jackpotParams[rule.TAMQUOC_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) //奖池初始值
|
||||
|
||||
//AI机器人爆奖
|
||||
val := this.jackpot.VirtualJK
|
||||
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))
|
||||
}
|
||||
}
|
||||
|
@ -299,11 +299,11 @@ func (this *TamQuocSceneData) KickPlayerByTime() {
|
|||
}
|
||||
//for _, p := range this.players {
|
||||
// //游戏次数达到目标值
|
||||
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId()))
|
||||
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.GetDBGameFree().GetId()))
|
||||
// if !p.IsRob &&
|
||||
// todayGamefreeIDSceneData != nil &&
|
||||
// this.DbGameFree.GetPlayNumLimit() != 0 &&
|
||||
// todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) {
|
||||
// this.GetDBGameFree().GetPlayNumLimit() != 0 &&
|
||||
// todayGamefreeIDSceneData.GameTimes >= int64(this.GetDBGameFree().GetPlayNumLimit()) {
|
||||
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -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)
|
||||
if sceneEx, ok := s.ExtraData.(*TamQuocSceneData); ok {
|
||||
playerEx := &TamQuocPlayerData{Player: p}
|
||||
playerEx.init(s) // 玩家当前信息初始化
|
||||
playerEx.score = sceneEx.DbGameFree.GetBaseScore() // 底注
|
||||
playerEx.init(s) // 玩家当前信息初始化
|
||||
playerEx.score = sceneEx.GetDBGameFree().GetBaseScore() // 底注
|
||||
sceneEx.players[p.SnId] = playerEx
|
||||
p.ExtraData = playerEx
|
||||
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) {
|
||||
logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId)
|
||||
pack := &tamquoc.SCTamQuocRoomInfo{
|
||||
RoomId: proto.Int(s.SceneId),
|
||||
RoomId: s.SceneId,
|
||||
Creator: proto.Int32(s.Creator),
|
||||
GameId: proto.Int(s.GameId),
|
||||
RoomMode: proto.Int(s.GameMode),
|
||||
GameId: s.GameId,
|
||||
RoomMode: s.GameMode,
|
||||
Params: common.CopySliceInt64ToInt32(s.Params),
|
||||
State: proto.Int(s.SceneState.GetState()),
|
||||
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.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)
|
||||
if playerEx.totalPriceBonus > 0 && playerEx.bonusGameStartTime.Add(TamQuocBonusGamePickTime).Before(time.Now()) {
|
||||
playerEx.totalPriceBonus = 0
|
||||
|
@ -339,7 +339,7 @@ func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, op
|
|||
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)
|
||||
return false
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, op
|
|||
if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin {
|
||||
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_CoinNotEnough, params)
|
||||
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)
|
||||
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)
|
||||
|
||||
//税收比例
|
||||
taxRate := sceneEx.DbGameFree.GetTaxRate()
|
||||
taxRate := sceneEx.GetDBGameFree().GetTaxRate()
|
||||
if taxRate < 0 || taxRate > 10000 {
|
||||
logger.Logger.Tracef("TamQuocErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate)
|
||||
taxRate = 500
|
||||
|
@ -410,8 +410,8 @@ func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, op
|
|||
prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额
|
||||
|
||||
// 奖池参数
|
||||
var jackpotParam = sceneEx.DbGameFree.GetJackpot()
|
||||
var jackpotInit = int64(jackpotParam[rule.TAMQUOC_JACKPOT_InitJackpot]) * int64(sceneEx.DbGameFree.GetBaseScore()) //奖池初始值
|
||||
var jackpotParam = sceneEx.GetDBGameFree().GetJackpot()
|
||||
var jackpotInit = int64(jackpotParam[rule.TAMQUOC_JACKPOT_InitJackpot]) * int64(sceneEx.GetDBGameFree().GetBaseScore()) //奖池初始值
|
||||
|
||||
var jackpotFundAdd, prizeFundAdd int64
|
||||
if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注
|
||||
|
@ -431,7 +431,7 @@ func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, op
|
|||
//统计参与游戏次数
|
||||
//if !sceneEx.Testing && !playerEx.IsRob {
|
||||
// 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)}},
|
||||
// }
|
||||
// proto.SetDefaults(pack)
|
||||
|
@ -454,11 +454,11 @@ func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, op
|
|||
var slotDataIsOk bool
|
||||
for i := 0; i < 3; i++ {
|
||||
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}
|
||||
//}
|
||||
spinRes = sceneEx.CalcLinePrize(slotData, playerEx.betLines, params[0])
|
||||
//if sceneEx.DbGameFree.GetSceneType() == 1 {
|
||||
//if sceneEx.GetDBGameFree().GetSceneType() == 1 {
|
||||
// slotDataIsOk = true
|
||||
// break
|
||||
//}
|
||||
|
@ -641,7 +641,7 @@ func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, op
|
|||
case TamQuocPlayerHistory:
|
||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||
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{}
|
||||
for _, v := range gpl.Data {
|
||||
//if v.GameDetailedLogId == "" {
|
||||
|
@ -759,7 +759,7 @@ func TamQuocCheckAndSaveLog(sceneEx *TamQuocSceneData, playerEx *TamQuocPlayerDa
|
|||
|
||||
//log2
|
||||
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.AfterCoin = playerEx.Coin
|
||||
playerEx.RollGameType.BaseResult.BeforeCoin = startCoin
|
||||
|
@ -818,8 +818,8 @@ func TamQuocCheckAndSaveLog(sceneEx *TamQuocSceneData, playerEx *TamQuocPlayerDa
|
|||
GameCoinTs: proto.Int64(playerEx.GameCoinTs),
|
||||
}
|
||||
gwPlayerBet := &server.GWPlayerData{
|
||||
SceneId: proto.Int(sceneEx.SceneId),
|
||||
GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()),
|
||||
SceneId: sceneEx.SceneId,
|
||||
GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
|
||||
}
|
||||
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
|
||||
sceneEx.SyncPlayerDatas(&base.PlayerDataParam{
|
||||
|
|
|
@ -368,15 +368,15 @@ func (this *SceneEx) ThirteenWaterCreateRoomInfoPacket(s *base.Scene, p *base.Pl
|
|||
}
|
||||
|
||||
func (this *SceneEx) GetBaseScore() int64 { //游戏底分
|
||||
if this.DbGameFree.FreeMode == 1 {
|
||||
if this.GetDBGameFree().FreeMode == 1 {
|
||||
baseScore := this.GetParam(rule.ParamBaseScore)
|
||||
if baseScore > 0 {
|
||||
return baseScore
|
||||
}
|
||||
}
|
||||
|
||||
if this.DbGameFree != nil {
|
||||
return int64(this.DbGameFree.GetBaseScore())
|
||||
if this.GetDBGameFree() != nil {
|
||||
return int64(this.GetDBGameFree().GetBaseScore())
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
@ -1268,7 +1268,7 @@ func (this *SceneEx) CountBilled() {
|
|||
}
|
||||
if playerEx.gainCoin > 0 {
|
||||
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
|
||||
}
|
||||
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 {
|
||||
robotPlayers = append(robotPlayers, seat)
|
||||
} 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))
|
||||
if seat.odds > 0 {
|
||||
realPlayersGood = append(realPlayersGood, seat)
|
||||
|
|
|
@ -1258,9 +1258,9 @@ func (this *StateBilled) OnEnter(s *base.Scene) {
|
|||
if sceneEx.gamePlayerNum-sceneEx.robotNum > 0 {
|
||||
/////////////////////////////////////统计牌局详细记录
|
||||
thirteenWaterType := model.ThirteenWaterType{
|
||||
RoomId: int32(sceneEx.SceneId),
|
||||
RoomId: sceneEx.SceneId,
|
||||
RoomRounds: int32(sceneEx.NumOfGames),
|
||||
RoomType: int32(sceneEx.SceneType),
|
||||
RoomType: sceneEx.GetSceneType(),
|
||||
BaseScore: int32(sceneEx.GetBaseScore()),
|
||||
NowRound: int32(sceneEx.NumOfGames),
|
||||
ClubRate: sceneEx.Scene.PumpCoin,
|
||||
|
@ -1462,7 +1462,7 @@ func (this *StateBilled) OnLeave(s *base.Scene) {
|
|||
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)
|
||||
}
|
||||
s.TryRelease()
|
||||
|
|
|
@ -386,7 +386,7 @@ func (this *TienLenSceneData) BroadcastOpPos() {
|
|||
for _, seat := range this.seats {
|
||||
if seat != nil && seat.IsGameing() {
|
||||
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 {
|
||||
B -= seat.odds
|
||||
}
|
||||
|
@ -538,7 +538,7 @@ func (this *TienLenSceneData) IsTienLenToEnd() bool {
|
|||
return common.IsTienLenToEnd(this.GetGameId())
|
||||
}
|
||||
func (this *TienLenSceneData) GetFreeGameSceneType() int32 {
|
||||
return int32(this.SceneType)
|
||||
return this.GetSceneType()
|
||||
}
|
||||
|
||||
// 比赛场发牌
|
||||
|
@ -1076,7 +1076,7 @@ func (this *TienLenSceneData) SendHandCardOdds() {
|
|||
if seat.IsRob {
|
||||
robotPlayers = append(robotPlayers, seat)
|
||||
} 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))
|
||||
if seat.odds > 0 {
|
||||
realPlayersGood = append(realPlayersGood, seat)
|
||||
|
@ -1087,7 +1087,7 @@ func (this *TienLenSceneData) SendHandCardOdds() {
|
|||
} else {
|
||||
realPlayers = append(realPlayers, seat)
|
||||
}
|
||||
_, isNovice := seat.NoviceOdds(this.GameId)
|
||||
_, isNovice := seat.NoviceOdds(int(this.GameId))
|
||||
if isNovice {
|
||||
novicePlayers = append(novicePlayers, seat)
|
||||
} else {
|
||||
|
@ -1967,7 +1967,7 @@ func (this *TienLenSceneData) TrySmallGameBilled() {
|
|||
logger.Logger.Trace("宠物技能抵挡炸弹生效,发送消息 SCTienLenPetSkillRes: ", pack)
|
||||
}
|
||||
if score != 0 {
|
||||
taxRate := this.DbGameFree.GetTaxRate() //万分比
|
||||
taxRate := this.GetDBGameFree().GetTaxRate() //万分比
|
||||
gainScore := int64(float64(score) * float64(10000-taxRate) / 10000.0) //税后
|
||||
bombTaxScore := score - gainScore
|
||||
// win
|
||||
|
|
|
@ -423,7 +423,7 @@ func TienLenCreateRoomInfoPacket(s *base.Scene, p *base.Player, sceneEx *TienLen
|
|||
State: proto.Int32(int32(s.GetSceneState().GetState())),
|
||||
TimeOut: proto.Int(s.GetSceneState().GetTimeout(s)),
|
||||
NumOfGames: proto.Int(sceneEx.NumOfGames),
|
||||
TotalOfGames: proto.Int(sceneEx.TotalOfGames),
|
||||
TotalOfGames: sceneEx.TotalOfGames,
|
||||
CurOpIdx: proto.Int(-1),
|
||||
MasterSnid: proto.Int32(sceneEx.masterSnid),
|
||||
AudienceNum: proto.Int(s.GetAudiencesNum()),
|
||||
|
@ -432,18 +432,26 @@ func TienLenCreateRoomInfoPacket(s *base.Scene, p *base.Player, sceneEx *TienLen
|
|||
RankType: s.GetDBGameFree().GetRankType(),
|
||||
SceneAdd: s.GetDBGameFree().GetSceneAdd(),
|
||||
// 比赛场相关
|
||||
Round: int32(s.MatchRound),
|
||||
CurPlayerNum: int32(s.MatchCurPlayerNum),
|
||||
NextNeed: int32(s.MatchNextNeed),
|
||||
Round: s.GetMatch().GetCurrRound(),
|
||||
CurPlayerNum: s.GetMatch().GetCurrPlayerNum(),
|
||||
NextNeed: s.GetMatch().GetNextPlayerNum(),
|
||||
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)
|
||||
// 0.普通场 1.锦标赛 2.冠军赛 3.vip专属
|
||||
if s.IsMatchScene() {
|
||||
pack.IsMatch = int32(s.MatchType)
|
||||
pack.IsMatch = s.GetMatch().GetMatchType()
|
||||
}
|
||||
pack.MatchFinals = 0
|
||||
if s.MatchFinals {
|
||||
if s.GetMatch().GetIsFinals() {
|
||||
pack.MatchFinals = 1
|
||||
if s.NumOfGames >= 2 {
|
||||
pack.MatchFinals = 2
|
||||
|
@ -879,7 +887,7 @@ func (this *SceneWaitStartStateTienLen) OnTick(s *base.Scene) {
|
|||
if sceneEx, ok := s.GetExtraData().(*TienLenSceneData); ok {
|
||||
if sceneEx.IsMatchScene() {
|
||||
delayT := time.Second * 2
|
||||
if sceneEx.MatchRound != 1 { //第一轮延迟2s,其他延迟3s 配合客户端播放动画
|
||||
if sceneEx.GetMatch().GetCurrRound() != 1 { //第一轮延迟2s,其他延迟3s 配合客户端播放动画
|
||||
delayT = time.Second * 4
|
||||
}
|
||||
if time.Now().Sub(sceneEx.StateStartTime) > delayT {
|
||||
|
@ -985,7 +993,7 @@ func (this *SceneHandCardStateTienLen) OnEnter(s *base.Scene) {
|
|||
seat.tianHu = rule.TianHu12Straight
|
||||
}
|
||||
if seat.tianHu > 0 {
|
||||
keyNovice := common.GetKeyNoviceGameId(sceneEx.GameId)
|
||||
keyNovice := common.GetKeyNoviceGameId(int(sceneEx.GameId))
|
||||
data, ok := seat.GDatas[keyNovice]
|
||||
if !ok {
|
||||
data = &model.PlayerGameInfo{FirstTime: time.Now()}
|
||||
|
@ -1640,14 +1648,14 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
|
|||
winRankScore := int64(0)
|
||||
pack := &tienlen.SCTienLenGameBilled{}
|
||||
tienlenType := model.TienLenType{
|
||||
GameId: sceneEx.GameId,
|
||||
GameId: int(sceneEx.GameId),
|
||||
RoomId: int32(sceneEx.GetSceneId()),
|
||||
RoomType: sceneEx.GetFreeGameSceneType(),
|
||||
NumOfGames: int32(sceneEx.Scene.NumOfGames),
|
||||
BankId: sceneEx.masterSnid,
|
||||
PlayerCount: sceneEx.curGamingPlayerNum,
|
||||
BaseScore: s.GetBaseScore(),
|
||||
TaxRate: s.DbGameFree.GetTaxRate(),
|
||||
TaxRate: s.GetDBGameFree().GetTaxRate(),
|
||||
RoomMode: s.GetSceneMode(),
|
||||
PlayerPool: make(map[int]int),
|
||||
}
|
||||
|
@ -2023,7 +2031,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
|
|||
var otherScore int64 // 额外总加分
|
||||
oldRankScore := playerEx.GetRankScore(sceneEx.GetDBGameFree().GetRankType())
|
||||
rankScore = loseRankScore
|
||||
taxRate := sceneEx.DbGameFree.GetTaxRate() //万分比
|
||||
taxRate := sceneEx.GetDBGameFree().GetTaxRate() //万分比
|
||||
gainScore := int64(float64(losePlayerScore) * float64(10000-taxRate) / 10000.0) //税后
|
||||
gainTaxScore := losePlayerScore - gainScore // 税收
|
||||
if playerNum == 3 {
|
||||
|
@ -2133,7 +2141,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
|
|||
var otherScore int64 // 额外总加分
|
||||
oldRankScore := playerEx.GetRankScore(sceneEx.GetDBGameFree().GetRankType())
|
||||
rankScore = lastWinPlayerRankScore
|
||||
taxRate := sceneEx.DbGameFree.GetTaxRate() //万分比
|
||||
taxRate := sceneEx.GetDBGameFree().GetTaxRate() //万分比
|
||||
gainScore := int64(float64(lastWinPlayerScore) * float64(10000-taxRate) / 10000.0) //税后
|
||||
gainTaxScore := lastWinPlayerScore - gainScore
|
||||
if sceneEx.IsMatchScene() || sceneEx.IsCustom() {
|
||||
|
@ -2414,7 +2422,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
|
|||
var otherScore int64 // 额外总加分
|
||||
playerEx := sceneEx.players[winSnid]
|
||||
if playerEx != nil {
|
||||
taxRate := sceneEx.DbGameFree.GetTaxRate() //万分比
|
||||
taxRate := sceneEx.GetDBGameFree().GetTaxRate() //万分比
|
||||
gainScore := int64(float64(winScore) * float64(10000-taxRate) / 10000.0) //税后
|
||||
gainTaxScore := winScore - gainScore
|
||||
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.RoundLogId = append(sceneEx.RoundLogId, sceneEx.recordId)
|
||||
if sceneEx.NumOfGames >= sceneEx.TotalOfGames {
|
||||
if sceneEx.NumOfGames >= int(sceneEx.TotalOfGames) {
|
||||
sceneEx.BilledList = make(map[int32]*[]*BilledInfo)
|
||||
sceneEx.RoundEndTime = sceneEx.RoundEndTime[:0]
|
||||
sceneEx.RoundLogId = sceneEx.RoundLogId[:0]
|
||||
|
@ -2780,10 +2788,10 @@ func (this *SceneBilledStateTienLen) OnLeave(s *base.Scene) {
|
|||
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)
|
||||
}
|
||||
if s.TotalOfGames > 0 && s.NumOfGames >= s.TotalOfGames {
|
||||
if s.TotalOfGames > 0 && s.NumOfGames >= int(s.TotalOfGames) {
|
||||
sceneEx.SceneDestroy(true)
|
||||
}
|
||||
s.RankMatchDestroy()
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -167,32 +167,44 @@ message Item {
|
|||
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
|
||||
message WGCreateScene {
|
||||
int32 SceneId = 1;
|
||||
int32 GameId = 2;
|
||||
int32 GameMode = 3;
|
||||
repeated int64 Params = 4;
|
||||
int32 Creator = 5;
|
||||
int32 Agentor = 6;
|
||||
string ReplayCode = 7;
|
||||
repeated int64 ParamsEx = 8;
|
||||
int32 SceneMode = 9;
|
||||
int32 HallId = 10;
|
||||
string Platform = 11;
|
||||
DB_GameFree DBGameFree = 12;
|
||||
int32 GroupId = 13;
|
||||
bool EnterAfterStart = 14;
|
||||
int32 TotalOfGames = 15;
|
||||
int32 Club = 16; //俱乐部Id
|
||||
string ClubRoomId = 17;
|
||||
int32 ClubRoomPos = 18;
|
||||
int32 ClubRate = 19;
|
||||
int32 BaseScore = 20;
|
||||
int32 PlayerNum = 21;
|
||||
bool RealCtrl = 22;
|
||||
repeated int32 ChessRank = 23;
|
||||
repeated Item Items = 24; // 奖励道具
|
||||
string Platform = 1; // 平台
|
||||
int32 SceneId = 2; // 房间id
|
||||
int32 GameId = 3; // 游戏id
|
||||
int32 GameMode = 4; // 废弃,游戏模式
|
||||
int32 SceneMode = 5; // 房间模式
|
||||
string ReplayCode = 6; // 回放码
|
||||
DB_GameFree DBGameFree = 7; // 场次配置
|
||||
int32 TotalOfGames = 8; // 总局数
|
||||
int32 PlayerNum = 9; // 最大玩家数
|
||||
bool EnterAfterStart = 10; // 是否开始后可加入
|
||||
int32 Creator = 11; // 创建者id
|
||||
int32 BaseScore = 12; // 底分
|
||||
repeated Item Items = 13; // 获得道具
|
||||
repeated Item CostItems = 14; // 消耗道具
|
||||
CustomParam Custom = 15; // 房卡场参数
|
||||
MatchParam Match = 16; // 比赛场参数
|
||||
repeated int32 ChessRank = 26; // 象棋段位配置
|
||||
repeated int64 Params = 27; // 游戏参数,GameRule中定义,不要有其他用途,含义不明确
|
||||
}
|
||||
|
||||
//PACKET_WG_DESTROYSCENE
|
||||
|
|
|
@ -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
|
||||
logger.Logger.Trace("CSEnterRoomHandler scene is closed")
|
||||
logger.Logger.Trace("CSEnterRoomHandler password error")
|
||||
goto failed
|
||||
}
|
||||
|
||||
|
@ -153,9 +153,8 @@ func (this *CSEnterRoomHandler) Process(s *netlib.Session, packetid int, data in
|
|||
}
|
||||
skinId := int32(300001)
|
||||
var tm *TmMatch
|
||||
if len(scene.params) > 3 {
|
||||
sortId := scene.params[0]
|
||||
tm = TournamentMgr.GetTm(sortId)
|
||||
if scene.MatchSortId > 0 {
|
||||
tm = TournamentMgr.GetTm(scene.MatchSortId)
|
||||
if tm != nil && tm.copyRobotGrades != nil && len(tm.copyRobotGrades) > 0 {
|
||||
randIndex := rand.Intn(len(tm.copyRobotGrades))
|
||||
grade = tm.copyRobotGrades[randIndex].grade
|
||||
|
@ -1260,7 +1259,7 @@ func CSCreatePrivateRoomHandler(s *netlib.Session, packetId int, data interface{
|
|||
return nil
|
||||
}
|
||||
// 游戏是否开启
|
||||
if cfg.GetOn() != common.On || gf.GetStatus() {
|
||||
if cfg.GetOn() != common.On || !gf.GetStatus() {
|
||||
code = gamehall.OpResultCode_Game_OPRC_GameHadClosed
|
||||
send()
|
||||
return nil
|
||||
|
@ -1287,22 +1286,24 @@ func CSCreatePrivateRoomHandler(s *netlib.Session, packetId int, data interface{
|
|||
csp := CoinSceneMgrSingleton.GetCoinScenePool(p.GetPlatform().IdStr, msg.GetGameFreeId())
|
||||
roomId := SceneMgrSingleton.GenOnePrivateSceneId()
|
||||
scene := SceneMgrSingleton.CreateScene(&CreateSceneParam{
|
||||
CreateId: p.SnId,
|
||||
RoomId: roomId,
|
||||
SceneMode: common.SceneMode_Private,
|
||||
CycleTimes: 0,
|
||||
TotalRound: int(msg.GetRound()),
|
||||
Params: common.CopySliceInt32ToInt64(csp.dbGameRule.GetParams()),
|
||||
GS: nil,
|
||||
Platform: PlatformMgrSingleton.GetPlatform(p.Platform),
|
||||
GF: csp.dbGameFree,
|
||||
PlayerNum: msg.GetPlayerNum(),
|
||||
Password: password,
|
||||
Voice: int32(voice),
|
||||
Channel: cfg.GetOnChannelName(),
|
||||
RoomType: PlatformMgrSingleton.GetConfig(p.Platform).RoomType[cfg.GetRoomType()],
|
||||
RoomConfig: cfg,
|
||||
RoomCostType: int(msg.GetCostType()),
|
||||
CreateId: p.SnId,
|
||||
RoomId: roomId,
|
||||
SceneMode: common.SceneMode_Private,
|
||||
CycleTimes: 0,
|
||||
TotalRound: int(msg.GetRound()),
|
||||
Params: common.CopySliceInt32ToInt64(csp.dbGameRule.GetParams()),
|
||||
GS: nil,
|
||||
Platform: PlatformMgrSingleton.GetPlatform(p.Platform),
|
||||
GF: csp.dbGameFree,
|
||||
PlayerNum: msg.GetPlayerNum(),
|
||||
Channel: cfg.GetOnChannelName(),
|
||||
CustomParam: &server.CustomParam{
|
||||
RoomTypeId: cfg.GetRoomType(),
|
||||
RoomConfigId: cfg.GetId(),
|
||||
CostType: int32(costType),
|
||||
Password: password,
|
||||
Voice: int32(voice),
|
||||
},
|
||||
})
|
||||
|
||||
if scene == nil {
|
||||
|
@ -1364,7 +1365,7 @@ func CSGetPrivateRoomListHandler(s *netlib.Session, packetId int, data interface
|
|||
})
|
||||
for _, v := range scenes {
|
||||
needPassword := 0
|
||||
if v.password != "" {
|
||||
if v.GetPassword() != "" {
|
||||
needPassword = 1
|
||||
}
|
||||
var players []*gamehall.PrivatePlayerInfo
|
||||
|
@ -1378,8 +1379,8 @@ func CSGetPrivateRoomListHandler(s *netlib.Session, packetId int, data interface
|
|||
d := &gamehall.PrivateRoomInfo{
|
||||
GameFreeId: v.dbGameFree.GetId(),
|
||||
GameId: v.dbGameFree.GetGameId(),
|
||||
RoomTypeId: v.RoomType.GetId(),
|
||||
RoomConfigId: v.RoomConfig.GetId(),
|
||||
RoomTypeId: v.GetRoomTypeId(),
|
||||
RoomConfigId: v.GetRoomConfigId(),
|
||||
RoomId: int32(v.sceneId),
|
||||
NeedPassword: int32(needPassword),
|
||||
CurrRound: v.currRound,
|
||||
|
|
|
@ -58,7 +58,7 @@ func init() {
|
|||
case scene.IsMatchScene():
|
||||
if !MatchSceneMgrSingleton.PlayerLeave(p, int(msg.GetReason())) {
|
||||
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 {
|
||||
//结算积分
|
||||
if !p.IsRob {
|
||||
|
@ -366,7 +366,7 @@ func init() {
|
|||
case scene.IsMatchScene():
|
||||
if !MatchSceneMgrSingleton.PlayerLeave(p, int(msg.GetReason())) {
|
||||
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:
|
||||
scene.PlayerLeave(p, int(msg.GetReason()))
|
||||
|
@ -538,7 +538,7 @@ func init() {
|
|||
if scene != nil {
|
||||
scene.State = msg.GetState()
|
||||
scene.StateSec = msg.GetSec()
|
||||
scene.BankerListNum = msg.GetBankerListNum()
|
||||
//scene.BankerListNum = msg.GetBankerListNum()
|
||||
if scene.State == scene.sp.GetBetState() {
|
||||
scene.StateTs = msg.GetTs()
|
||||
leftTime := int64(scene.StateSec) - (time.Now().Unix() - scene.StateTs)
|
||||
|
|
|
@ -184,7 +184,7 @@ func CSRoomList(s *netlib.Session, packetId int, data interface{}, sid int64) er
|
|||
audience := msg.GetTp() == 1
|
||||
scenes := TournamentMgr.GetTmRoom(p.Platform, 0, p.LastChannel, audience, msg.GetId())
|
||||
for _, v := range scenes {
|
||||
tm := TournamentMgr.GetTm(v.matchId)
|
||||
tm := TournamentMgr.GetTm(v.MatchSortId)
|
||||
if tm == nil {
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -151,45 +151,55 @@ func (this *GameSession) OnStateOff() {
|
|||
this.Send(int(server_proto.SSPacketID_PACKET_WG_SERVER_STATE), pack)
|
||||
}
|
||||
|
||||
func (this *GameSession) AddScene(s *Scene) {
|
||||
this.scenes[s.sceneId] = s
|
||||
type AddSceneParam struct {
|
||||
S *Scene
|
||||
}
|
||||
|
||||
func (this *GameSession) AddScene(args *AddSceneParam) {
|
||||
this.scenes[args.S.sceneId] = args.S
|
||||
//send msg
|
||||
msg := &server_proto.WGCreateScene{
|
||||
SceneId: proto.Int(s.sceneId),
|
||||
GameId: proto.Int(s.gameId),
|
||||
GameMode: proto.Int(s.gameMode),
|
||||
SceneMode: proto.Int(s.sceneMode),
|
||||
Params: s.params,
|
||||
Creator: proto.Int32(s.creator),
|
||||
HallId: proto.Int32(s.hallId),
|
||||
ReplayCode: proto.String(s.replayCode),
|
||||
GroupId: proto.Int32(s.groupId),
|
||||
TotalOfGames: proto.Int32(s.totalRound),
|
||||
BaseScore: proto.Int32(s.BaseScore),
|
||||
PlayerNum: proto.Int(s.playerNum),
|
||||
DBGameFree: s.dbGameFree,
|
||||
Platform: s.limitPlatform.IdStr,
|
||||
Platform: args.S.limitPlatform.IdStr,
|
||||
SceneId: int32(args.S.sceneId),
|
||||
GameId: int32(args.S.gameId),
|
||||
GameMode: int32(args.S.gameMode),
|
||||
SceneMode: int32(args.S.sceneMode),
|
||||
ReplayCode: args.S.replayCode,
|
||||
DBGameFree: args.S.dbGameFree,
|
||||
TotalOfGames: args.S.totalRound,
|
||||
PlayerNum: int32(args.S.playerNum),
|
||||
Creator: args.S.creator,
|
||||
BaseScore: args.S.BaseScore,
|
||||
Custom: args.S.CustomParam,
|
||||
Match: args.S.MatchParam,
|
||||
Params: args.S.params,
|
||||
}
|
||||
if s.RoomConfig != nil {
|
||||
for _, v := range s.RoomConfig.GetCost() {
|
||||
msg.Items = append(msg.Items, &server_proto.Item{
|
||||
Id: v.GetItemId(),
|
||||
Num: v.GetItemNum(),
|
||||
})
|
||||
if args.S.GetRoomTypeId() != 0 {
|
||||
cfg := PlatformMgrSingleton.GetConfig(args.S.limitPlatform.IdStr).RoomConfig[args.S.GetRoomTypeId()]
|
||||
if cfg != nil {
|
||||
for _, v := range cfg.GetReward() {
|
||||
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 := s.sp.(*ScenePolicyData); ok {
|
||||
msg.EnterAfterStart = proto.Bool(sp.EnterAfterStart)
|
||||
}
|
||||
if sp, ok := args.S.sp.(*ScenePolicyData); ok {
|
||||
msg.EnterAfterStart = proto.Bool(sp.EnterAfterStart)
|
||||
}
|
||||
// 象棋游戏添加段位配置
|
||||
if s.dbGameFree != nil && s.dbGameFree.GameDif == common.GameDifChess {
|
||||
msg.ChessRank = ChessRankMgrSington.GetChessRankArr(s.limitPlatform.Name, int32(s.gameId))
|
||||
if args.S.dbGameFree != nil && srvdata.GameFreeMgr.IsGameDif(int32(args.S.gameId), common.GameDifChess) {
|
||||
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)
|
||||
logger.Logger.Trace("WGCreateScene:", msg)
|
||||
logger.Logger.Tracef("WGCreateScene: %v", msg)
|
||||
}
|
||||
|
||||
func (this *GameSession) DelScene(s *Scene) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"mongo.games.com/game/srvdata"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
|
||||
"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]
|
||||
}
|
||||
}
|
||||
// 建房参数
|
||||
// 比赛唯一索引,是否决赛,第几轮,本轮总人数,下一轮总人数,赛制类型
|
||||
params := []int64{tm.SortId, int64(finals), int64(round), int64(curPlayerNum), int64(nextNeed), int64(tm.gmd.MatchType)}
|
||||
rule := srvdata.PBDB_GameRuleMgr.GetData(tm.dbGameFree.GetGameRule())
|
||||
scene := SceneMgrSingleton.CreateScene(&CreateSceneParam{
|
||||
RoomId: sceneId,
|
||||
SceneMode: common.SceneMode_Match,
|
||||
Params: params,
|
||||
Params: common.CopySliceInt32ToInt64(rule.GetParams()),
|
||||
Platform: limitPlatform,
|
||||
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 {
|
||||
scene.matchId = tm.SortId
|
||||
return scene
|
||||
}
|
||||
return nil
|
||||
|
@ -153,7 +160,7 @@ func (ms *MatchSceneMgr) PlayerLeave(p *Player, reason int) bool {
|
|||
if p == nil || p.scene == nil {
|
||||
return true
|
||||
}
|
||||
if p.scene.matchId == 0 {
|
||||
if p.scene.MatchSortId == 0 {
|
||||
return true
|
||||
}
|
||||
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) {
|
||||
if SceneMgrSingleton.scenes != nil && tm != nil {
|
||||
for _, scene := range SceneMgrSingleton.scenes {
|
||||
if scene.IsMatchScene() && scene.matchId == tm.SortId {
|
||||
if scene.IsMatchScene() && scene.MatchSortId == tm.SortId {
|
||||
scene.SendGameDestroy(false)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ import (
|
|||
"mongo.games.com/game/proto"
|
||||
hallproto "mongo.games.com/game/protocol/gamehall"
|
||||
serverproto "mongo.games.com/game/protocol/server"
|
||||
webapiproto "mongo.games.com/game/protocol/webapi"
|
||||
"mongo.games.com/game/srvdata"
|
||||
)
|
||||
|
||||
|
@ -39,73 +38,51 @@ type PlayerGameCtx struct {
|
|||
totalConvertibleFlow int64 //进房时玩家身上的总流水
|
||||
}
|
||||
|
||||
// MatchParams 比赛场配置
|
||||
type MatchParams struct {
|
||||
MatchId int64 // 比赛场id
|
||||
}
|
||||
|
||||
// CustomParams 房卡场配置
|
||||
type CustomParams struct {
|
||||
RoomType *webapiproto.RoomType // 房卡场房间类型id
|
||||
RoomConfig *webapiproto.RoomConfig // 房卡场房间配置id
|
||||
RoomCostType int // 房卡收费方式
|
||||
}
|
||||
|
||||
// Scene 场景(房间)
|
||||
// todo 结构优化
|
||||
type Scene struct {
|
||||
sceneId int // 场景id
|
||||
gameId int // 游戏id
|
||||
gameMode int // 游戏模式(玩法)
|
||||
sceneMode int // 房间模式,参考common.SceneMode_XXX
|
||||
params []int64 // 场景参数
|
||||
playerNum int // 房间最大人数
|
||||
robotNum int // 机器人数量
|
||||
robotLimit int // 最大限制机器人数量
|
||||
preInviteRobNum int // 准备邀请机器人的数量
|
||||
creator int32 // 创建者账号id
|
||||
replayCode string // 回放码
|
||||
currRound int32 // 当前第几轮
|
||||
totalRound int32 // 总共几轮,小于等于0表示无限轮
|
||||
cycleTimes int32 // 循环次数
|
||||
deleting bool // 正在删除
|
||||
starting bool // 正在开始
|
||||
closed bool // 房间已关闭
|
||||
force bool // 强制删除
|
||||
players map[int32]*Player // 玩家
|
||||
audiences map[int32]*Player // 观众
|
||||
seats [9]*Player // 座位
|
||||
gameSess *GameSession // 所在gameserver
|
||||
sp ScenePolicy // 场景上的一些业务策略
|
||||
createTime time.Time // 创建时间
|
||||
lastTime time.Time // 最后活跃时间
|
||||
startTime time.Time // 开始时间
|
||||
applyTimes map[int32]int32 // 申请坐下次数
|
||||
limitPlatform *Platform // 限制平台
|
||||
groupId int32 // 组id
|
||||
hallId int32 // 厅id
|
||||
dbGameFree *serverproto.DB_GameFree // 场次配置
|
||||
gameCtx map[int32]*PlayerGameCtx // 进入房间的环境
|
||||
BaseScore int32 // 游戏底分,优先级,创建参数>本地配置>场次配置
|
||||
SceneState int32 // 房间当前状态
|
||||
State int32 // 当前游戏状态,后期放到ScenePolicy里去处理
|
||||
StateTs int64 // 切换到当前状态的时间
|
||||
StateSec int32 // 押注状态的秒数
|
||||
password string // 密码
|
||||
channel []string // 渠道,房卡场有渠道限制
|
||||
voice int32 // 是否开启语音 1开启
|
||||
|
||||
matchId int64 // 比赛场id
|
||||
fishing int32 // 渔场的鱼潮状态
|
||||
GameLog []int32 // 游戏服务器同步的录单
|
||||
BankerListNum int32 // 庄家列表数量
|
||||
matchParams []int32 // 比赛参数
|
||||
matchState int // 比赛状态
|
||||
|
||||
CustomParams // 房卡场参数
|
||||
|
||||
csp *CoinScenePool // 所在场景池
|
||||
hp *HundredSceneMgr // 百人场房间池
|
||||
sceneId int // 场景id
|
||||
gameId int // 游戏id
|
||||
gameMode int // 游戏模式(玩法)
|
||||
sceneMode int // 房间模式,参考common.SceneMode_XXX
|
||||
params []int64 // 场景参数
|
||||
playerNum int // 房间最大人数
|
||||
robotNum int // 机器人数量
|
||||
robotLimit int // 最大限制机器人数量
|
||||
preInviteRobNum int // 准备邀请机器人的数量
|
||||
creator int32 // 创建者账号id
|
||||
replayCode string // 回放码
|
||||
currRound int32 // 当前第几轮
|
||||
totalRound int32 // 总共几轮,小于等于0表示无限轮
|
||||
cycleTimes int32 // 循环次数
|
||||
deleting bool // 正在删除
|
||||
starting bool // 正在开始
|
||||
closed bool // 房间已关闭
|
||||
force bool // 强制删除
|
||||
players map[int32]*Player // 玩家
|
||||
audiences map[int32]*Player // 观众
|
||||
seats [9]*Player // 座位
|
||||
gameSess *GameSession // 所在gameserver
|
||||
sp ScenePolicy // 场景上的一些业务策略
|
||||
createTime time.Time // 创建时间
|
||||
lastTime time.Time // 最后活跃时间
|
||||
startTime time.Time // 开始时间
|
||||
applyTimes map[int32]int32 // 申请坐下次数
|
||||
limitPlatform *Platform // 限制平台
|
||||
groupId int32 // 组id
|
||||
hallId int32 // 厅id
|
||||
dbGameFree *serverproto.DB_GameFree // 场次配置
|
||||
gameCtx map[int32]*PlayerGameCtx // 进入房间的环境
|
||||
BaseScore int32 // 游戏底分,优先级,创建参数>本地配置>场次配置
|
||||
SceneState int32 // 房间当前状态
|
||||
State int32 // 当前游戏状态,后期放到ScenePolicy里去处理
|
||||
StateTs int64 // 切换到当前状态的时间
|
||||
StateSec int32 // 押注状态的秒数
|
||||
Channel []string // 客户端类型
|
||||
*serverproto.CustomParam // 房卡场参数
|
||||
*serverproto.MatchParam // 比赛场参数
|
||||
csp *CoinScenePool // 所在场景池
|
||||
hp *HundredSceneMgr // 百人场房间池
|
||||
}
|
||||
|
||||
// NewScene 创建房间
|
||||
|
@ -141,15 +118,10 @@ func NewScene(args *CreateSceneParam) *Scene {
|
|||
dbGameFree: args.GF,
|
||||
currRound: 0,
|
||||
totalRound: int32(args.TotalRound),
|
||||
password: args.Password,
|
||||
voice: args.Voice,
|
||||
channel: args.Channel,
|
||||
BaseScore: args.BaseScore,
|
||||
CustomParams: CustomParams{
|
||||
RoomType: args.RoomType,
|
||||
RoomConfig: args.RoomConfig,
|
||||
RoomCostType: args.RoomCostType,
|
||||
},
|
||||
Channel: args.Channel,
|
||||
CustomParam: args.CustomParam,
|
||||
MatchParam: args.MatchParam,
|
||||
}
|
||||
// 最大房间人数
|
||||
if s.playerNum <= 0 {
|
||||
|
@ -165,9 +137,6 @@ func NewScene(args *CreateSceneParam) *Scene {
|
|||
if s.cycleTimes <= 0 {
|
||||
s.cycleTimes = 1
|
||||
}
|
||||
if s.totalRound <= 0 {
|
||||
s.totalRound = 1
|
||||
}
|
||||
s.lastTime = s.createTime
|
||||
s.replayCode = SceneMgrSingleton.AllocReplayCode()
|
||||
|
||||
|
@ -837,15 +806,15 @@ func (this *Scene) GetSceneName() string {
|
|||
|
||||
func (this *Scene) RandRobotCnt() {
|
||||
if this.dbGameFree != nil {
|
||||
numrng := this.dbGameFree.GetRobotNumRng()
|
||||
if len(numrng) >= 2 {
|
||||
if numrng[1] == numrng[0] {
|
||||
this.robotLimit = int(numrng[0])
|
||||
number := this.dbGameFree.GetRobotNumRng()
|
||||
if len(number) >= 2 {
|
||||
if number[1] == number[0] {
|
||||
this.robotLimit = int(number[0])
|
||||
} else {
|
||||
if numrng[1] < numrng[0] {
|
||||
numrng[1], numrng[0] = numrng[0], numrng[1]
|
||||
if number[1] < number[0] {
|
||||
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
|
||||
|
@ -973,10 +942,10 @@ func (this *Scene) TryForceDeleteMatchInfo() {
|
|||
if len(this.players) == 0 {
|
||||
return
|
||||
}
|
||||
if this.matchId == 0 {
|
||||
if this.MatchSortId == 0 {
|
||||
return
|
||||
}
|
||||
if players, exist := TournamentMgr.players[this.matchId]; exist {
|
||||
if players, exist := TournamentMgr.players[this.MatchSortId]; exist {
|
||||
for _, player := range this.players {
|
||||
if player != nil && !player.IsRob {
|
||||
if TournamentMgr.IsMatching(player.SnId) {
|
||||
|
@ -990,8 +959,8 @@ func (this *Scene) TryForceDeleteMatchInfo() {
|
|||
// CanAudience 是否允许观战
|
||||
func (this *Scene) CanAudience() bool {
|
||||
switch {
|
||||
case this.matchId > 0: // 比赛场
|
||||
tm := TournamentMgr.GetTm(this.matchId)
|
||||
case this.GetMatchSortId() > 0: // 比赛场
|
||||
tm := TournamentMgr.GetTm(this.GetMatchSortId())
|
||||
if tm != nil {
|
||||
return tm.gmd.GetAudienceSwitch() == 1
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ func (m *SceneMgr) GetScenesByGameFreeId(gameFreeId int32) []*Scene {
|
|||
func (m *SceneMgr) GetMatchRoom(sortId int64) []*Scene {
|
||||
var scenes []*Scene
|
||||
for _, value := range m.scenes {
|
||||
if value.matchId == sortId {
|
||||
if value.MatchSortId == sortId {
|
||||
s := m.GetScene(value.sceneId)
|
||||
if s != nil {
|
||||
scenes = append(scenes, value)
|
||||
|
@ -223,7 +223,7 @@ func (m *SceneMgr) MarshalAllRoom(platform string, groupId, gameId int, gameMode
|
|||
isContinue := false
|
||||
if snId != 0 {
|
||||
for _, p := range s.players {
|
||||
if p.SnId == int32(snId) {
|
||||
if p.SnId == snId {
|
||||
isContinue = true
|
||||
break
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ func (m *SceneMgr) FindRoomList(args *FindRoomParam) []*Scene {
|
|||
if len(args.Channel) > 0 {
|
||||
has := false
|
||||
for _, vv := range args.Channel {
|
||||
if slices.Contains(v.channel, vv) {
|
||||
if slices.Contains(v.Channel, vv) {
|
||||
has = true
|
||||
break
|
||||
}
|
||||
|
@ -367,23 +367,20 @@ func (m *SceneMgr) FindRoomList(args *FindRoomParam) []*Scene {
|
|||
}
|
||||
|
||||
type CreateSceneParam struct {
|
||||
CreateId int32 // 创建者id
|
||||
RoomId int // 房间id
|
||||
SceneMode int // 公共,私人,赛事
|
||||
CycleTimes int // 循环次数
|
||||
TotalRound int // 总轮数
|
||||
Params []int64 // 房间参数
|
||||
GS *GameSession
|
||||
Platform *Platform
|
||||
GF *serverproto.DB_GameFree
|
||||
PlayerNum int32 // 玩家最大数量
|
||||
Password string
|
||||
Voice int32 // 1开启
|
||||
Channel []string
|
||||
RoomType *webapiproto.RoomType
|
||||
RoomConfig *webapiproto.RoomConfig
|
||||
BaseScore int32
|
||||
RoomCostType int
|
||||
CreateId int32 // 创建者id
|
||||
RoomId int // 房间id
|
||||
SceneMode int // 公共,私人,赛事
|
||||
CycleTimes int // 循环次数
|
||||
TotalRound int // 总轮数
|
||||
Params []int64 // 房间参数
|
||||
GS *GameSession // 游戏服务
|
||||
Platform *Platform // 所在平台
|
||||
GF *serverproto.DB_GameFree // 场次配置
|
||||
PlayerNum int32 // 玩家最大数量
|
||||
BaseScore int32 // 底分
|
||||
Channel []string // 客户端类型,允许查看的客户端类型
|
||||
*serverproto.CustomParam // 房卡场参数
|
||||
*serverproto.MatchParam // 比赛场参数
|
||||
}
|
||||
|
||||
// CreateScene 创建房间
|
||||
|
@ -409,7 +406,9 @@ func (m *SceneMgr) CreateScene(args *CreateSceneParam) *Scene {
|
|||
}
|
||||
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)
|
||||
|
||||
// 创建水池
|
||||
|
@ -443,7 +442,7 @@ func (m *SceneMgr) DestroyScene(sceneId int, isCompleted bool) {
|
|||
s.gameSess.DelScene(s)
|
||||
s.OnClose()
|
||||
delete(m.scenes, s.sceneId)
|
||||
delete(m.password, s.password)
|
||||
delete(m.password, s.GetPassword())
|
||||
logger.Logger.Infof("(this *SceneMgr) DestroyScene, SceneId=%v", sceneId)
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
if roomConfig == nil {
|
||||
return false
|
||||
}
|
||||
return spd.costEnough(costType, playerNum, roomConfig, p, func(items []*model.Item) {})
|
||||
}
|
||||
|
||||
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{
|
||||
P: p.PlayerData,
|
||||
Change: items,
|
||||
|
@ -130,7 +137,7 @@ func (spd *ScenePolicyData) CostPayment(s *Scene, p *Player) bool {
|
|||
Remark: "竞技馆进房费用",
|
||||
GameId: int64(s.gameId),
|
||||
GameFreeId: int64(s.dbGameFree.GetId()),
|
||||
RoomConfigId: s.RoomConfig.GetId(),
|
||||
RoomConfigId: roomConfig.GetId(),
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue