Compare commits
3 Commits
a5bf9df289
...
a0596475a7
Author | SHA1 | Date |
---|---|---|
|
a0596475a7 | |
|
7232de625d | |
|
06ed65d88f |
|
@ -2094,11 +2094,6 @@ func (this *Scene) Statistics(param *StaticParam) {
|
|||
|
||||
logger.Logger.Tracef("Statistics gameId:%v wbLevel:%v gain:%v addGain:%v", this.GameId, wbLevel, param.Gain, addGain)
|
||||
|
||||
// 比赛场,私人房不统计
|
||||
if this.IsMatchScene() || this.IsPrivateScene() {
|
||||
return
|
||||
}
|
||||
|
||||
var totalIn int64
|
||||
var totalOut int64
|
||||
now := time.Now()
|
||||
|
@ -2181,6 +2176,40 @@ func (this *Scene) Statistics(param *StaticParam) {
|
|||
statics = append(statics, &data.Statics)
|
||||
}
|
||||
|
||||
f := func(list []*model.PlayerGameStatics) {
|
||||
for _, data := range list {
|
||||
if data != nil {
|
||||
if !this.IsMatchScene() && !this.IsPrivateScene() { // 比赛场,私人房不统计
|
||||
data.TotalIn += totalIn
|
||||
data.TotalOut += totalOut
|
||||
data.Tax += param.GainTax
|
||||
}
|
||||
if param.IsAddTimes {
|
||||
data.GameTimes++
|
||||
if param.Gain > 0 {
|
||||
data.WinGameTimes++
|
||||
data.WinGameTimesNum++
|
||||
data.LoseGameTimesNum = 0
|
||||
} else if param.Gain < 0 {
|
||||
data.LoseGameTimes++
|
||||
data.LoseGameTimesNum++
|
||||
data.WinGameTimesNum = 0
|
||||
} else {
|
||||
data.DrawGameTimes++
|
||||
data.WinGameTimesNum = 0
|
||||
data.LoseGameTimesNum = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
f(statics)
|
||||
statics = statics[:0]
|
||||
|
||||
if this.IsMatchScene() || this.IsPrivateScene() {
|
||||
return
|
||||
}
|
||||
|
||||
// 新手输赢统计
|
||||
if !model.GameParamData.CloseNovice && !common.InSliceInt(model.GameParamData.CloseNoviceGame, int(this.GameId)) && isControl && wbLevel == 0 && isNovice {
|
||||
keyNoviceGameId := common.GetKeyNoviceGameId(int(this.GameId))
|
||||
|
@ -2249,29 +2278,8 @@ func (this *Scene) Statistics(param *StaticParam) {
|
|||
logger.Logger.Tracef("Statistics PlayerPool gameId:%v wbLevel:%v gain:%v addGain:%v", this.GameId, wbLevel, param.Gain, addGain)
|
||||
}
|
||||
|
||||
for _, data := range statics {
|
||||
if data != nil {
|
||||
data.TotalIn += totalIn
|
||||
data.TotalOut += totalOut
|
||||
data.Tax += param.GainTax
|
||||
if param.IsAddTimes {
|
||||
data.GameTimes++
|
||||
if param.Gain > 0 {
|
||||
data.WinGameTimes++
|
||||
data.WinGameTimesNum++
|
||||
data.LoseGameTimesNum = 0
|
||||
} else if param.Gain < 0 {
|
||||
data.LoseGameTimes++
|
||||
data.LoseGameTimesNum++
|
||||
data.WinGameTimesNum = 0
|
||||
} else {
|
||||
data.DrawGameTimes++
|
||||
data.WinGameTimesNum = 0
|
||||
data.LoseGameTimesNum = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
f(statics)
|
||||
statics = statics[:0]
|
||||
|
||||
// 玩家身上元数据
|
||||
if param.IsAddTimes {
|
||||
|
|
|
@ -73,6 +73,7 @@ type TienLenSceneData struct {
|
|||
RoundLogId []string // 每局牌局记录id
|
||||
CustomLogSave bool // 是否已经保存日志
|
||||
PlayerAward map[int32]*[]*model.Item // 房卡场最终奖励
|
||||
bill *tienlen.SCTienLenGameBilled
|
||||
}
|
||||
|
||||
func NewTienLenSceneData(s *base.Scene) *TienLenSceneData {
|
||||
|
|
|
@ -2623,6 +2623,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
|
|||
proto.SetDefaults(pack)
|
||||
s.Broadcast(int(tienlen.TienLenPacketID_PACKET_SCTienLenGameBilled), pack, 0)
|
||||
logger.Logger.Trace("TienLenPacketID_PACKET_SCTienLenGameBilled gameFreeId:", sceneEx.GetGameFreeId(), ";pack:", pack)
|
||||
sceneEx.bill = pack
|
||||
|
||||
if sceneEx.IsCustom() && sceneEx.TotalOfGames > 0 {
|
||||
for _, v := range tienlenType.PlayerData {
|
||||
|
@ -2932,6 +2933,16 @@ func (this *SceneBilledStateTienLen) OnPlayerOp(s *base.Scene, p *base.Player, o
|
|||
// 玩家事件
|
||||
func (this *SceneBilledStateTienLen) OnPlayerEvent(s *base.Scene, p *base.Player, evtcode int, params []int64) {
|
||||
this.SceneBaseStateTienLen.OnPlayerEvent(s, p, evtcode, params)
|
||||
sceneEx, ok := s.GetExtraData().(*TienLenSceneData)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
switch evtcode {
|
||||
case base.PlayerEventRehold:
|
||||
if sceneEx.bill != nil && sceneEx.IsRankMatch() {
|
||||
p.SendToClient(int(tienlen.TienLenPacketID_PACKET_SCTienLenGameBilled), sceneEx.bill)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (this *SceneBilledStateTienLen) OnTick(s *base.Scene) {
|
||||
|
|
Loading…
Reference in New Issue