Compare commits
3 Commits
e1812b5ecf
...
5e0b6139f9
Author | SHA1 | Date |
---|---|---|
|
5e0b6139f9 | |
|
39b71ea93f | |
|
35c0e07004 |
|
@ -1632,6 +1632,8 @@ func (this *Scene) NewBigCoinNotice(player *Player, num int64, msgType int64) {
|
||||||
|
|
||||||
type GameDetailedParam struct {
|
type GameDetailedParam struct {
|
||||||
Trend20Lately string //最近20局开奖结果
|
Trend20Lately string //最近20局开奖结果
|
||||||
|
CtrlType int
|
||||||
|
PlayerPool map[int]int
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保存详细游戏日志
|
// 保存详细游戏日志
|
||||||
|
@ -1651,7 +1653,8 @@ func (this *Scene) SaveGameDetailedLog(logid string, gamedetailednote string, ga
|
||||||
log := model.NewGameDetailedLogEx(logid, int32(this.GameId), int32(this.SceneId),
|
log := model.NewGameDetailedLogEx(logid, int32(this.GameId), int32(this.SceneId),
|
||||||
this.DbGameFree.GetGameMode(), this.DbGameFree.Id, int32(len(this.Players)),
|
this.DbGameFree.GetGameMode(), this.DbGameFree.Id, int32(len(this.Players)),
|
||||||
int32(time.Now().Unix()-this.GameNowTime.Unix()), baseScore,
|
int32(time.Now().Unix()-this.GameNowTime.Unix()), baseScore,
|
||||||
gamedetailednote, p.Platform, this.ClubId, this.RoomId, this.CpCtx, GameDetailedVer[this.GameId], trend20Lately)
|
gamedetailednote, p.Platform, this.ClubId, this.RoomId, this.CpCtx, GameDetailedVer[this.GameId], trend20Lately,
|
||||||
|
gameDetailedParam.CtrlType, gameDetailedParam.PlayerPool)
|
||||||
if log != nil {
|
if log != nil {
|
||||||
if this.IsMatchScene() {
|
if this.IsMatchScene() {
|
||||||
log.MatchId = this.MatchId
|
log.MatchId = this.MatchId
|
||||||
|
@ -1664,7 +1667,8 @@ func (this *Scene) SaveGameDetailedLog(logid string, gamedetailednote string, ga
|
||||||
log := model.NewGameDetailedLogEx(logid, int32(this.GameId), int32(this.SceneId),
|
log := model.NewGameDetailedLogEx(logid, int32(this.GameId), int32(this.SceneId),
|
||||||
this.DbGameFree.GetGameMode(), this.DbGameFree.Id, int32(len(this.Players)),
|
this.DbGameFree.GetGameMode(), this.DbGameFree.Id, int32(len(this.Players)),
|
||||||
int32(time.Now().Unix()-this.GameNowTime.Unix()), baseScore,
|
int32(time.Now().Unix()-this.GameNowTime.Unix()), baseScore,
|
||||||
gamedetailednote, this.Platform, this.ClubId, this.RoomId, this.CpCtx, GameDetailedVer[this.GameId], trend20Lately)
|
gamedetailednote, this.Platform, this.ClubId, this.RoomId, this.CpCtx, GameDetailedVer[this.GameId], trend20Lately,
|
||||||
|
gameDetailedParam.CtrlType, gameDetailedParam.PlayerPool)
|
||||||
if log != nil {
|
if log != nil {
|
||||||
if this.IsMatchScene() {
|
if this.IsMatchScene() {
|
||||||
log.MatchId = this.MatchId
|
log.MatchId = this.MatchId
|
||||||
|
|
|
@ -29,6 +29,7 @@ type TienLenPlayerData struct {
|
||||||
curHandLimitTimeOut time.Duration // 出牌时间上限
|
curHandLimitTimeOut time.Duration // 出牌时间上限
|
||||||
isNotOverLastHand bool //手牌不能压过上家出牌标志
|
isNotOverLastHand bool //手牌不能压过上家出牌标志
|
||||||
cardScore int // 手牌评分
|
cardScore int // 手牌评分
|
||||||
|
playerPool int // 个人水池分
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *TienLenPlayerData) init() {
|
func (this *TienLenPlayerData) init() {
|
||||||
|
@ -49,6 +50,7 @@ func (this *TienLenPlayerData) init() {
|
||||||
this.curHandLimitTimeOut = rule.TienLenPlayerOpTimeout
|
this.curHandLimitTimeOut = rule.TienLenPlayerOpTimeout
|
||||||
this.isNotOverLastHand = false
|
this.isNotOverLastHand = false
|
||||||
this.cardScore = 0
|
this.cardScore = 0
|
||||||
|
this.playerPool = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *TienLenPlayerData) Clear() {
|
func (this *TienLenPlayerData) Clear() {
|
||||||
|
@ -67,6 +69,7 @@ func (this *TienLenPlayerData) Clear() {
|
||||||
this.ThinkLongCnt = 0
|
this.ThinkLongCnt = 0
|
||||||
this.curHandLimitTimeOut = rule.TienLenPlayerOpTimeout
|
this.curHandLimitTimeOut = rule.TienLenPlayerOpTimeout
|
||||||
this.isNotOverLastHand = false
|
this.isNotOverLastHand = false
|
||||||
|
this.playerPool = 0
|
||||||
|
|
||||||
this.MarkFlag(base.PlayerState_WaitNext)
|
this.MarkFlag(base.PlayerState_WaitNext)
|
||||||
this.TestLog = this.TestLog[:0]
|
this.TestLog = this.TestLog[:0]
|
||||||
|
|
|
@ -55,6 +55,7 @@ type TienLenSceneData struct {
|
||||||
cHintCards []int32 //客户端提示出牌记录
|
cHintCards []int32 //客户端提示出牌记录
|
||||||
isCardsKu bool //是否是牌库
|
isCardsKu bool //是否是牌库
|
||||||
cardsKuId int32 //牌库ID
|
cardsKuId int32 //牌库ID
|
||||||
|
ctrlType int // 1控赢 2控输 0不控
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTienLenSceneData(s *base.Scene) *TienLenSceneData {
|
func NewTienLenSceneData(s *base.Scene) *TienLenSceneData {
|
||||||
|
@ -85,6 +86,7 @@ func (this *TienLenSceneData) init() bool {
|
||||||
this.card_play_action_seq_int32 = [][]int32{}
|
this.card_play_action_seq_int32 = [][]int32{}
|
||||||
this.bombToEnd = 0
|
this.bombToEnd = 0
|
||||||
this.allPlayerCards = [][]int32{}
|
this.allPlayerCards = [][]int32{}
|
||||||
|
this.ctrlType = 0
|
||||||
this.recordId, _ = model.AutoIncGameLogId()
|
this.recordId, _ = model.AutoIncGameLogId()
|
||||||
if this.GetPlayerNum() == 0 {
|
if this.GetPlayerNum() == 0 {
|
||||||
this.SetPlayerNum(rule.MaxNumOfPlayer)
|
this.SetPlayerNum(rule.MaxNumOfPlayer)
|
||||||
|
@ -114,6 +116,7 @@ func (this *TienLenSceneData) Clear() {
|
||||||
this.isAllRob = false
|
this.isAllRob = false
|
||||||
this.robotGamingNum = 0
|
this.robotGamingNum = 0
|
||||||
this.allPlayerCards = [][]int32{}
|
this.allPlayerCards = [][]int32{}
|
||||||
|
this.ctrlType = 0
|
||||||
this.recordId, _ = model.AutoIncGameLogId()
|
this.recordId, _ = model.AutoIncGameLogId()
|
||||||
for _, player := range this.players {
|
for _, player := range this.players {
|
||||||
if player != nil {
|
if player != nil {
|
||||||
|
@ -1053,6 +1056,7 @@ func (this *TienLenSceneData) SendHandCardOdds() {
|
||||||
robotPlayers = append(robotPlayers, seat)
|
robotPlayers = append(robotPlayers, seat)
|
||||||
} else {
|
} else {
|
||||||
seat.odds = this.GetPlayerOdds(seat.Player, this.GameId, this.robotGamingNum > 0)
|
seat.odds = this.GetPlayerOdds(seat.Player, this.GameId, this.robotGamingNum > 0)
|
||||||
|
seat.playerPool = int(this.PlayerPoolOdds(seat.Player))
|
||||||
if seat.odds > 0 {
|
if seat.odds > 0 {
|
||||||
realPlayersGood = append(realPlayersGood, seat)
|
realPlayersGood = append(realPlayersGood, seat)
|
||||||
G += seat.odds
|
G += seat.odds
|
||||||
|
@ -1233,6 +1237,7 @@ func (this *TienLenSceneData) SendHandCardOdds() {
|
||||||
logger.Logger.Tracef("TienLen SendHandCardOdds Good:%v G:%v Bad:%v B:%v", isGood, G, isBad, B)
|
logger.Logger.Tracef("TienLen SendHandCardOdds Good:%v G:%v Bad:%v B:%v", isGood, G, isBad, B)
|
||||||
|
|
||||||
if isBad && !isTestPoker && len(robotPlayers) > 0 && !noviceCtrl && !noviceTianHu {
|
if isBad && !isTestPoker && len(robotPlayers) > 0 && !noviceCtrl && !noviceTianHu {
|
||||||
|
this.ctrlType = 2
|
||||||
gf := base.ConfigMgrInst.GetConfig(this.Platform).GameConfig
|
gf := base.ConfigMgrInst.GetConfig(this.Platform).GameConfig
|
||||||
items := []int32{gf.GetTianHu(), gf.GetPaiKu(), gf.GetFenCha()}
|
items := []int32{gf.GetTianHu(), gf.GetPaiKu(), gf.GetFenCha()}
|
||||||
score := this.RandInt(int(gf.GetTianHu() + gf.GetPaiKu() + gf.GetFenCha()))
|
score := this.RandInt(int(gf.GetTianHu() + gf.GetPaiKu() + gf.GetFenCha()))
|
||||||
|
@ -1495,7 +1500,8 @@ func (this *TienLenSceneData) SendHandCardOdds() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !isBad && !isTestPoker && !noviceCtrl && !noviceTianHu { // 天胡调控没有生效
|
if !isBad && !isTestPoker && !noviceCtrl && !noviceTianHu { // 天胡调控没有生效
|
||||||
if isGood || isBad {
|
if isGood {
|
||||||
|
this.ctrlType = 1
|
||||||
// 牌平分,按从大到小排序
|
// 牌平分,按从大到小排序
|
||||||
// 使用分差配置,最好牌和最差牌的牌型分差大于分差配置
|
// 使用分差配置,最好牌和最差牌的牌型分差大于分差配置
|
||||||
for i := 0; i < 20; i++ { // 尝试20次,如果还不能满足分差配置,则直接发牌
|
for i := 0; i < 20; i++ { // 尝试20次,如果还不能满足分差配置,则直接发牌
|
||||||
|
|
|
@ -1606,6 +1606,13 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
|
||||||
BaseScore: s.GetBaseScore(),
|
BaseScore: s.GetBaseScore(),
|
||||||
TaxRate: s.DbGameFree.GetTaxRate(),
|
TaxRate: s.DbGameFree.GetTaxRate(),
|
||||||
RoomMode: s.GetSceneMode(),
|
RoomMode: s.GetSceneMode(),
|
||||||
|
PlayerPool: make(map[int]int),
|
||||||
|
}
|
||||||
|
for _, v := range sceneEx.seats {
|
||||||
|
if v == nil || !v.IsGameing() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
tienlenType.PlayerPool[int(v.SnId)] = v.playerPool
|
||||||
}
|
}
|
||||||
|
|
||||||
nGamingPlayerCount := sceneEx.GetGameingPlayerCnt()
|
nGamingPlayerCount := sceneEx.GetGameingPlayerCnt()
|
||||||
|
@ -2499,7 +2506,11 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
|
||||||
}
|
}
|
||||||
if isSave {
|
if isSave {
|
||||||
// 牌局记录
|
// 牌局记录
|
||||||
sceneEx.SaveGameDetailedLog(sceneEx.recordId, info, &base.GameDetailedParam{})
|
sceneEx.SaveGameDetailedLog(sceneEx.recordId, info, &base.GameDetailedParam{
|
||||||
|
Trend20Lately: "",
|
||||||
|
CtrlType: sceneEx.ctrlType,
|
||||||
|
PlayerPool: tienlenType.PlayerPool,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,8 @@ type GameDetailedLog struct {
|
||||||
Time time.Time //记录时间
|
Time time.Time //记录时间
|
||||||
Trend20Lately string //最近游戏走势
|
Trend20Lately string //最近游戏走势
|
||||||
Ts int64 //时间戳
|
Ts int64 //时间戳
|
||||||
|
CtrlType int // 1控赢 2控输 0不控
|
||||||
|
PlayerPool map[int]int // 个人水池分
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGameDetailedLog() *GameDetailedLog {
|
func NewGameDetailedLog() *GameDetailedLog {
|
||||||
|
@ -63,7 +65,7 @@ func NewGameDetailedLog() *GameDetailedLog {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGameDetailedLogEx(logid string, gameid, sceneid, gamemode, gamefreeid, playercount, gametiming, gamebasebet int32,
|
func NewGameDetailedLogEx(logid string, gameid, sceneid, gamemode, gamefreeid, playercount, gametiming, gamebasebet int32,
|
||||||
gamedetailednote string, platform string, clubId int32, clubRoom string, cpCtx CoinPoolCtx, ver int32, trend20Lately string) *GameDetailedLog {
|
gamedetailednote string, platform string, clubId int32, clubRoom string, cpCtx CoinPoolCtx, ver int32, trend20Lately string, ctrlType int, playerPool map[int]int) *GameDetailedLog {
|
||||||
cl := NewGameDetailedLog()
|
cl := NewGameDetailedLog()
|
||||||
cl.LogId = logid
|
cl.LogId = logid
|
||||||
cl.GameId = gameid
|
cl.GameId = gameid
|
||||||
|
@ -83,6 +85,8 @@ func NewGameDetailedLogEx(logid string, gameid, sceneid, gamemode, gamefreeid, p
|
||||||
cl.GameDetailVer = ver
|
cl.GameDetailVer = ver
|
||||||
cl.Trend20Lately = trend20Lately
|
cl.Trend20Lately = trend20Lately
|
||||||
cl.Ts = time.Now().Unix()
|
cl.Ts = time.Now().Unix()
|
||||||
|
cl.CtrlType = ctrlType
|
||||||
|
cl.PlayerPool = playerPool
|
||||||
return cl
|
return cl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1521,6 +1521,8 @@ type TienLenType struct {
|
||||||
TaxRate int32 //税率(万分比)
|
TaxRate int32 //税率(万分比)
|
||||||
PlayerData []TienLenPerson //玩家信息
|
PlayerData []TienLenPerson //玩家信息
|
||||||
RoomMode int
|
RoomMode int
|
||||||
|
CtrlType int `json:"-"` // 1控赢 2控输 0不控
|
||||||
|
PlayerPool map[int]int `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type TienLenAddItem struct {
|
type TienLenAddItem struct {
|
||||||
|
|
|
@ -88,6 +88,7 @@ type GameParam struct {
|
||||||
TestActSwitch bool // 开启所有活动开关
|
TestActSwitch bool // 开启所有活动开关
|
||||||
RankPlayerLevelMaxNum int //等级榜最大人数
|
RankPlayerLevelMaxNum int //等级榜最大人数
|
||||||
CloseChannelSwitch bool //关闭渠道开关功能
|
CloseChannelSwitch bool //关闭渠道开关功能
|
||||||
|
BackendTimeLocal int //后台时区
|
||||||
}
|
}
|
||||||
|
|
||||||
var GameParamPath = "../data/gameparam.json"
|
var GameParamPath = "../data/gameparam.json"
|
||||||
|
@ -238,4 +239,7 @@ func InitGameParam() {
|
||||||
if GameParamData.RankPlayerLevelMaxNum == 0 {
|
if GameParamData.RankPlayerLevelMaxNum == 0 {
|
||||||
GameParamData.RankPlayerLevelMaxNum = 100
|
GameParamData.RankPlayerLevelMaxNum = 100
|
||||||
}
|
}
|
||||||
|
if GameParamData.BackendTimeLocal == 0 {
|
||||||
|
GameParamData.BackendTimeLocal = 8
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,10 +74,11 @@ type Message struct {
|
||||||
Params []int32 //额外参数
|
Params []int32 //额外参数
|
||||||
Platform string //平台信息
|
Platform string //平台信息
|
||||||
ShowId int64 //区分主子游戏大厅
|
ShowId int64 //区分主子游戏大厅
|
||||||
|
Channel []string //渠道
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMessage(pid string, srcId int32, srcName string, snid, mType int32, title, content string, coin, diamond int64,
|
func NewMessage(pid string, srcId int32, srcName string, snid, mType int32, title, content string, coin, diamond int64,
|
||||||
state int32, addTime int64, attachState int32, giftId string, params []int32, platform string, showId int64) *Message {
|
state int32, addTime int64, attachState int32, giftId string, params []int32, platform string, showId int64, channel []string) *Message {
|
||||||
if srcName == "" {
|
if srcName == "" {
|
||||||
srcName = "{\"zh\":\"系统\",\"vi\":\"GM\",\"en\":\"GM\",\"kh\":\"GM\"}"
|
srcName = "{\"zh\":\"系统\",\"vi\":\"GM\",\"en\":\"GM\",\"kh\":\"GM\"}"
|
||||||
}
|
}
|
||||||
|
@ -99,6 +100,7 @@ func NewMessage(pid string, srcId int32, srcName string, snid, mType int32, titl
|
||||||
Platform: platform,
|
Platform: platform,
|
||||||
Diamond: diamond,
|
Diamond: diamond,
|
||||||
ShowId: showId,
|
ShowId: showId,
|
||||||
|
Channel: channel,
|
||||||
}
|
}
|
||||||
if msg.Pid == "" {
|
if msg.Pid == "" {
|
||||||
msg.Pid = msg.Id.Hex()
|
msg.Pid = msg.Id.Hex()
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -468,6 +468,7 @@ message ASCreateShortMessage{
|
||||||
int64 Diamond = 8;
|
int64 Diamond = 8;
|
||||||
int64 ShowId = 9;
|
int64 ShowId = 9;
|
||||||
repeated int32 Params = 10;
|
repeated int32 Params = 10;
|
||||||
|
repeated string OnChannelName = 11;
|
||||||
}
|
}
|
||||||
message SACreateShortMessage{
|
message SACreateShortMessage{
|
||||||
TagCode Tag = 1; //错误码
|
TagCode Tag = 1; //错误码
|
||||||
|
@ -913,6 +914,8 @@ message ASAddItemById{
|
||||||
int32 Snid = 1; // 玩家id
|
int32 Snid = 1; // 玩家id
|
||||||
string Platform = 2; // 平台id
|
string Platform = 2; // 平台id
|
||||||
repeated ItemInfo ItemInfo = 3;//道具
|
repeated ItemInfo ItemInfo = 3;//道具
|
||||||
|
int32 TypeId = 4; // 变化类型
|
||||||
|
string Remark = 5; // 描述
|
||||||
}
|
}
|
||||||
|
|
||||||
message SAAddItemById{
|
message SAAddItemById{
|
||||||
|
|
|
@ -86,7 +86,7 @@ func (this *CSInviteCodePlayerHandler) Process(s *netlib.Session, packetid int,
|
||||||
//发送邮件
|
//发送邮件
|
||||||
var otherParams []int32
|
var otherParams []int32
|
||||||
newMsg := model.NewMessage("", p.SnId, "", p.SnId, model.MSGTYPE_INVITECODE, p.Name, inviteCode, coin, 0,
|
newMsg := model.NewMessage("", p.SnId, "", p.SnId, model.MSGTYPE_INVITECODE, p.Name, inviteCode, coin, 0,
|
||||||
model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, p.Platform, model.HallAll)
|
model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, p.Platform, model.HallAll, nil)
|
||||||
err = model.InsertMessage(p.Platform, newMsg)
|
err = model.InsertMessage(p.Platform, newMsg)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
||||||
|
|
|
@ -561,22 +561,21 @@ func (this *Player) SendGameConfig(gameId int32, plf, chl string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Player) LoadMessage(lastLogoutTime int64, isFirstLogin, isSkipWeek bool) {
|
func (this *Player) LoadMessage(lastLogoutTime int64, isFirstLogin, isSkipWeek bool) {
|
||||||
task.New(nil,
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
task.CallableWrapper(func(o *basic.Object) interface{} {
|
//msgs, err := model.GetMessageByNotState(this.SnId, model.MSGSTATE_REMOVEED)
|
||||||
//msgs, err := model.GetMessageByNotState(this.SnId, model.MSGSTATE_REMOVEED)
|
//if err == nil {
|
||||||
//if err == nil {
|
// return msgs
|
||||||
// return msgs
|
//} else {
|
||||||
//} else {
|
// logger.Logger.Warnf("[%v] LoadMessage err:%v", this.Name, err)
|
||||||
// logger.Logger.Warnf("[%v] LoadMessage err:%v", this.Name, err)
|
//}
|
||||||
//}
|
msgs, err := model.GetMessage(this.Platform, this.SnId) // model.GetNotDelMessage(this.Platform, this.SnId)
|
||||||
msgs, err := model.GetMessage(this.Platform, this.SnId) // model.GetNotDelMessage(this.Platform, this.SnId)
|
if err == nil {
|
||||||
if err == nil {
|
return msgs
|
||||||
return msgs
|
} else {
|
||||||
} else {
|
logger.Logger.Warnf("[%v] LoadMessage err:%v", this.Name, err)
|
||||||
logger.Logger.Warnf("[%v] LoadMessage err:%v", this.Name, err)
|
}
|
||||||
}
|
return nil
|
||||||
return nil
|
}),
|
||||||
}),
|
|
||||||
task.CompleteNotifyWrapper(func(data interface{}, tt task.Task) {
|
task.CompleteNotifyWrapper(func(data interface{}, tt task.Task) {
|
||||||
if data != nil {
|
if data != nil {
|
||||||
if msgs, ok := data.([]model.Message); ok {
|
if msgs, ok := data.([]model.Message); ok {
|
||||||
|
@ -612,7 +611,7 @@ func (this *Player) LoadMessage(lastLogoutTime int64, isFirstLogin, isSkipWeek b
|
||||||
if bHasAddToPlayer == false {
|
if bHasAddToPlayer == false {
|
||||||
newMsg := model.NewMessage(msg.Id.Hex(), msg.SrcId, "", this.SnId, msg.MType, msg.Title,
|
newMsg := model.NewMessage(msg.Id.Hex(), msg.SrcId, "", this.SnId, msg.MType, msg.Title,
|
||||||
msg.Content, msg.Coin, msg.Diamond, model.MSGSTATE_UNREAD, msg.CreatTs, msg.AttachState,
|
msg.Content, msg.Coin, msg.Diamond, model.MSGSTATE_UNREAD, msg.CreatTs, msg.AttachState,
|
||||||
msg.GiftId, msg.Params, msg.Platform, msg.ShowId)
|
msg.GiftId, msg.Params, msg.Platform, msg.ShowId, msg.Channel)
|
||||||
dbMsgs = append(dbMsgs, newMsg)
|
dbMsgs = append(dbMsgs, newMsg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -661,6 +660,9 @@ func (this *Player) SendMessage(showId int64) {
|
||||||
for _, msg := range this.msgs {
|
for _, msg := range this.msgs {
|
||||||
|
|
||||||
if msg.State != model.MSGSTATE_REMOVEED && (msg.ShowId == model.HallAll || msg.ShowId&showId != 0) {
|
if msg.State != model.MSGSTATE_REMOVEED && (msg.ShowId == model.HallAll || msg.ShowId&showId != 0) {
|
||||||
|
if len(msg.Channel) > 0 && !common.InSliceString(msg.Channel, this.LastChannel) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
giftState := int32(0)
|
giftState := int32(0)
|
||||||
//if len(msg.GiftId) > 0 {
|
//if len(msg.GiftId) > 0 {
|
||||||
|
@ -846,6 +848,10 @@ func (this *Player) AddMessage(msg *model.Message) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(msg.Channel) > 0 && !common.InSliceString(msg.Channel, this.LastChannel) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if _, exist := this.msgs[msg.Id.Hex()]; !exist {
|
if _, exist := this.msgs[msg.Id.Hex()]; !exist {
|
||||||
this.msgs[msg.Id.Hex()] = msg
|
this.msgs[msg.Id.Hex()] = msg
|
||||||
|
|
||||||
|
@ -1036,7 +1042,7 @@ func (this *Player) SendIosInstallStableMail() {
|
||||||
var newMsg *model.Message
|
var newMsg *model.Message
|
||||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
newMsg = model.NewMessage("", 0, "", this.SnId, model.MSGTYPE_IOSINSTALLSTABLE, "系统通知", fmt.Sprintf("感谢您下载稳定版本,额外奖励%d元,请查收", int(model.GameParamData.IosStableInstallPrize/100)),
|
newMsg = model.NewMessage("", 0, "", this.SnId, model.MSGTYPE_IOSINSTALLSTABLE, "系统通知", fmt.Sprintf("感谢您下载稳定版本,额外奖励%d元,请查收", int(model.GameParamData.IosStableInstallPrize/100)),
|
||||||
int64(model.GameParamData.IosStableInstallPrize), 0, 0, time.Now().Unix(), 0, "", nil, this.Platform, model.HallAll)
|
int64(model.GameParamData.IosStableInstallPrize), 0, 0, time.Now().Unix(), 0, "", nil, this.Platform, model.HallAll, nil)
|
||||||
return model.InsertMessage(this.Platform, newMsg)
|
return model.InsertMessage(this.Platform, newMsg)
|
||||||
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
||||||
if data == nil {
|
if data == nil {
|
||||||
|
@ -1055,7 +1061,7 @@ func (this *Player) TestMail() {
|
||||||
otherParams = append(otherParams, 20001, 3)
|
otherParams = append(otherParams, 20001, 3)
|
||||||
otherParams = append(otherParams, 20002, 3)
|
otherParams = append(otherParams, 20002, 3)
|
||||||
newMsg = model.NewMessage("", 0, "", this.SnId, model.MSGTYPE_ITEM, "系统通知道具test", "测试",
|
newMsg = model.NewMessage("", 0, "", this.SnId, model.MSGTYPE_ITEM, "系统通知道具test", "测试",
|
||||||
100000, 100, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, this.Platform, 0)
|
100000, 100, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, this.Platform, 0, nil)
|
||||||
return model.InsertMessage(this.Platform, newMsg)
|
return model.InsertMessage(this.Platform, newMsg)
|
||||||
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
||||||
if data == nil {
|
if data == nil {
|
||||||
|
@ -1075,7 +1081,7 @@ func (this *Player) TestSubMail() {
|
||||||
otherParams = append(otherParams, 20001, 3)
|
otherParams = append(otherParams, 20001, 3)
|
||||||
otherParams = append(otherParams, 20002, 3)
|
otherParams = append(otherParams, 20002, 3)
|
||||||
newMsg = model.NewMessage("", 0, "", 0, model.MSGTYPE_ITEM, "系统", "测试",
|
newMsg = model.NewMessage("", 0, "", 0, model.MSGTYPE_ITEM, "系统", "测试",
|
||||||
100000, 100, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, this.Platform, model.HallTienlen)
|
100000, 100, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, this.Platform, model.HallTienlen, nil)
|
||||||
return model.InsertMessage(this.Platform, newMsg)
|
return model.InsertMessage(this.Platform, newMsg)
|
||||||
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
||||||
if data == nil {
|
if data == nil {
|
||||||
|
|
|
@ -84,7 +84,7 @@ func (this *PlayerRankSeason) sendEmailAward(rankType int32) {
|
||||||
content := i18n.Tr("languages", "RankAward")
|
content := i18n.Tr("languages", "RankAward")
|
||||||
|
|
||||||
newMsg = model.NewMessage("", 0, "", this.SnId, model.MSGTYPE_RANK_REWARD,
|
newMsg = model.NewMessage("", 0, "", this.SnId, model.MSGTYPE_RANK_REWARD,
|
||||||
title, content, coin, diamond, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, this.Platform, model.HallTienlen)
|
title, content, coin, diamond, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, this.Platform, model.HallTienlen, nil)
|
||||||
|
|
||||||
return model.InsertMessage(this.Platform, newMsg)
|
return model.InsertMessage(this.Platform, newMsg)
|
||||||
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
nowtool "github.com/jinzhu/now"
|
||||||
"mongo.games.com/goserver/core/basic"
|
"mongo.games.com/goserver/core/basic"
|
||||||
"mongo.games.com/goserver/core/i18n"
|
"mongo.games.com/goserver/core/i18n"
|
||||||
"mongo.games.com/goserver/core/logger"
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
@ -25,6 +26,7 @@ import (
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
module.RegisteModule(TournamentMgr, time.Second, 0)
|
module.RegisteModule(TournamentMgr, time.Second, 0)
|
||||||
|
ClockMgrSington.RegisteSinker(TournamentMgr)
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -78,6 +80,7 @@ type PlayerRoundInfo struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Tournament struct {
|
type Tournament struct {
|
||||||
|
BaseClockSinker
|
||||||
GameMatchDateList map[string]map[int32]*webapiproto.GameMatchDate // 比赛配置,platform:比赛场配置id:比赛配置
|
GameMatchDateList map[string]map[int32]*webapiproto.GameMatchDate // 比赛配置,platform:比赛场配置id:比赛配置
|
||||||
singleSignupPlayers map[int32]*SignupInfo // 开启机器人时,报名的玩家,玩家Id:报名信息
|
singleSignupPlayers map[int32]*SignupInfo // 开启机器人时,报名的玩家,玩家Id:报名信息
|
||||||
signupPlayers map[string]map[int32]*SignInfo // 报名的玩家 platform:比赛配置id:报名人
|
signupPlayers map[string]map[int32]*SignInfo // 报名的玩家 platform:比赛配置id:报名人
|
||||||
|
@ -182,6 +185,7 @@ func (this *Tournament) UpdateData(init bool, data *webapiproto.GameMatchDateLis
|
||||||
configs := make(map[int32]*webapiproto.GameMatchDate)
|
configs := make(map[int32]*webapiproto.GameMatchDate)
|
||||||
for _, v := range data.List {
|
for _, v := range data.List {
|
||||||
if this.checkData(v) {
|
if this.checkData(v) {
|
||||||
|
this.FixMatchTimeStamp(v)
|
||||||
configs[v.Id] = v
|
configs[v.Id] = v
|
||||||
} else {
|
} else {
|
||||||
logger.Logger.Error("GameMatchDate error: ", v)
|
logger.Logger.Error("GameMatchDate error: ", v)
|
||||||
|
@ -274,17 +278,6 @@ func (this *Tournament) IsRobotOn(match *webapiproto.GameMatchDate) bool {
|
||||||
// IsTimeRange 判断是否在比赛时间段内
|
// IsTimeRange 判断是否在比赛时间段内
|
||||||
// 在时间段内才能报名
|
// 在时间段内才能报名
|
||||||
func (this *Tournament) IsTimeRange(gmd *webapiproto.GameMatchDate) bool {
|
func (this *Tournament) IsTimeRange(gmd *webapiproto.GameMatchDate) bool {
|
||||||
getWeekNum := func(t time.Time) int {
|
|
||||||
strWeek := []string{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}
|
|
||||||
week := t.Weekday()
|
|
||||||
for i, s := range strWeek {
|
|
||||||
if week.String() == s {
|
|
||||||
return i
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
if gmd == nil {
|
if gmd == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -299,17 +292,21 @@ func (this *Tournament) IsTimeRange(gmd *webapiproto.GameMatchDate) bool {
|
||||||
case 0:
|
case 0:
|
||||||
return true
|
return true
|
||||||
case 1:
|
case 1:
|
||||||
nowWeek := getWeekNum(tNow)
|
week := this.getWeekDay()
|
||||||
hms := int32(tNow.Hour()*10000 + tNow.Minute()*100 + tNow.Second())
|
for _, v := range gmd.MatchTimeWeek {
|
||||||
if gmd.MatchTimeWeek != nil && len(gmd.MatchTimeWeek) > 0 {
|
if week == int(v) {
|
||||||
for _, week := range gmd.MatchTimeWeek {
|
if gmd.MatchTimeStamp != nil && len(gmd.MatchTimeStamp) > 1 {
|
||||||
if nowWeek == int(week) {
|
this.FixMatchTimeStamp(gmd)
|
||||||
if hms >= gmd.MatchTimeStartHMS && hms <= gmd.MatchTimeEndHMS {
|
startStamp := gmd.MatchTimeStamp[0]
|
||||||
|
endStamp := gmd.MatchTimeStamp[1]
|
||||||
|
if tNow.Unix() >= startStamp && tNow.Unix() <= endStamp {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if gmd.MatchTimeStamp != nil && len(gmd.MatchTimeStamp) > 1 {
|
if gmd.MatchTimeStamp != nil && len(gmd.MatchTimeStamp) > 1 {
|
||||||
startStamp := gmd.MatchTimeStamp[0]
|
startStamp := gmd.MatchTimeStamp[0]
|
||||||
|
@ -1201,7 +1198,7 @@ func (this *Tournament) sendPromotionInfo(mc *PlayerMatchContext, sortId int64,
|
||||||
title := i18n.Tr("languages", "MatchAwardTitle")
|
title := i18n.Tr("languages", "MatchAwardTitle")
|
||||||
content := i18n.Tr("languages", "MatchAward", params)
|
content := i18n.Tr("languages", "MatchAward", params)
|
||||||
newMsg = model.NewMessage("", 0, "", mc.p.SnId, model.MSGTYPE_RANK_REWARD,
|
newMsg = model.NewMessage("", 0, "", mc.p.SnId, model.MSGTYPE_RANK_REWARD,
|
||||||
title, content, 0, 0, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", nil, mc.p.Platform, model.HallTienlen)
|
title, content, 0, 0, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", nil, mc.p.Platform, model.HallTienlen, nil)
|
||||||
err := model.InsertMessage(mc.p.Platform, newMsg)
|
err := model.InsertMessage(mc.p.Platform, newMsg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Logger.Errorf("发送邮件失败 snid:%v itemID:%v err:%v", mc.p.SnId, data.Id, err)
|
logger.Logger.Errorf("发送邮件失败 snid:%v itemID:%v err:%v", mc.p.SnId, data.Id, err)
|
||||||
|
@ -1534,3 +1531,61 @@ func (this *Tournament) Update() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Tournament) Shutdown() {}
|
func (this *Tournament) Shutdown() {}
|
||||||
|
|
||||||
|
func (this *Tournament) getWeekDay() int {
|
||||||
|
getWeekNum := func(t time.Time) int {
|
||||||
|
strWeek := []string{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}
|
||||||
|
week := t.Weekday()
|
||||||
|
for i, s := range strWeek {
|
||||||
|
if week.String() == s {
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
l := time.FixedZone("CST", model.GameParamData.BackendTimeLocal*3600)
|
||||||
|
bTs := time.Now().In(l)
|
||||||
|
week := getWeekNum(bTs)
|
||||||
|
return week
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Tournament) FixMatchTimeStamp(d *webapiproto.GameMatchDate) {
|
||||||
|
// 更新比赛时间
|
||||||
|
if d == nil || d.MatchTimeType != 1 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(d.MatchTimeStamp) != 2 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := time.FixedZone("CST", model.GameParamData.BackendTimeLocal*3600)
|
||||||
|
bTs := time.Now().In(l)
|
||||||
|
week := this.getWeekDay()
|
||||||
|
st := time.Unix(d.MatchTimeStamp[0], 0).In(l)
|
||||||
|
et := time.Unix(d.MatchTimeStamp[1], 0).In(l)
|
||||||
|
logger.Logger.Tracef("FixMatchTimeStamp 1 id:%v now:%v week:%v start:%v end:%v", d.Id, bTs, bTs.Weekday(), st, et)
|
||||||
|
// 重复时间段比赛时间
|
||||||
|
for _, v := range d.MatchTimeWeek {
|
||||||
|
if v == int32(week) {
|
||||||
|
stSub := st.Unix() - nowtool.New(st).BeginningOfDay().Unix()
|
||||||
|
sub := d.MatchTimeStamp[1] - d.MatchTimeStamp[0]
|
||||||
|
d.MatchTimeStamp[0] = nowtool.New(bTs).BeginningOfDay().Add(time.Duration(stSub) * time.Second).Unix()
|
||||||
|
d.MatchTimeStamp[1] = d.MatchTimeStamp[0] + sub
|
||||||
|
|
||||||
|
st = time.Unix(d.MatchTimeStamp[0], 0).In(l)
|
||||||
|
et = time.Unix(d.MatchTimeStamp[1], 0).In(l)
|
||||||
|
logger.Logger.Tracef("FixMatchTimeStamp 2 id:%v now:%v week:%v start:%v end:%v", d.Id, bTs, bTs.Weekday(), st, et)
|
||||||
|
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Tournament) OnHourTimer() {
|
||||||
|
for _, v := range this.GameMatchDateList {
|
||||||
|
for _, vv := range v {
|
||||||
|
this.FixMatchTimeStamp(vv)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -3229,6 +3229,10 @@ func init() {
|
||||||
diamond := msg.GetDiamond()
|
diamond := msg.GetDiamond()
|
||||||
otherParams := msg.GetParams()
|
otherParams := msg.GetParams()
|
||||||
showId := msg.GetShowId()
|
showId := msg.GetShowId()
|
||||||
|
channel := msg.GetOnChannelName()
|
||||||
|
if destSnid > 0 {
|
||||||
|
channel = []string{}
|
||||||
|
}
|
||||||
|
|
||||||
if messageType == model.MSGTYPE_ITEM && len(otherParams) != 0 && len(otherParams)%2 != 0 {
|
if messageType == model.MSGTYPE_ITEM && len(otherParams) != 0 && len(otherParams)%2 != 0 {
|
||||||
pack.Tag = webapiproto.TagCode_FAILED
|
pack.Tag = webapiproto.TagCode_FAILED
|
||||||
|
@ -3243,6 +3247,9 @@ func init() {
|
||||||
if p.IsRob == true { //排除掉机器人
|
if p.IsRob == true { //排除掉机器人
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if len(channel) > 0 && !common.InSliceString(channel, p.LastChannel) { // 渠道过滤
|
||||||
|
continue
|
||||||
|
}
|
||||||
if platform == "" || p.Platform == platform {
|
if platform == "" || p.Platform == platform {
|
||||||
onlinePlayerSnid = append(onlinePlayerSnid, p.SnId)
|
onlinePlayerSnid = append(onlinePlayerSnid, p.SnId)
|
||||||
}
|
}
|
||||||
|
@ -3265,7 +3272,7 @@ func init() {
|
||||||
// var otherParams []int32
|
// var otherParams []int32
|
||||||
|
|
||||||
newMsg = model.NewMessage("", int32(srcSnid), "", int32(destSnid), int32(messageType), title, content, coin, diamond,
|
newMsg = model.NewMessage("", int32(srcSnid), "", int32(destSnid), int32(messageType), title, content, coin, diamond,
|
||||||
model.MSGSTATE_UNREAD, time.Now().Unix(), model.MSGATTACHSTATE_DEFAULT, "", otherParams, platform, showId)
|
model.MSGSTATE_UNREAD, time.Now().Unix(), model.MSGATTACHSTATE_DEFAULT, "", otherParams, platform, showId, channel)
|
||||||
if newMsg != nil {
|
if newMsg != nil {
|
||||||
err := model.InsertMessage(platform, newMsg)
|
err := model.InsertMessage(platform, newMsg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -3278,7 +3285,7 @@ func init() {
|
||||||
if destSnid == 0 {
|
if destSnid == 0 {
|
||||||
for _, psnid := range onlinePlayerSnid {
|
for _, psnid := range onlinePlayerSnid {
|
||||||
newMsg := model.NewMessage(newMsg.Id.Hex(), newMsg.SrcId, "", psnid, newMsg.MType, newMsg.Title, newMsg.Content, newMsg.Coin, newMsg.Diamond,
|
newMsg := model.NewMessage(newMsg.Id.Hex(), newMsg.SrcId, "", psnid, newMsg.MType, newMsg.Title, newMsg.Content, newMsg.Coin, newMsg.Diamond,
|
||||||
newMsg.State, newMsg.CreatTs, newMsg.AttachState, newMsg.GiftId, otherParams, platform, newMsg.ShowId)
|
newMsg.State, newMsg.CreatTs, newMsg.AttachState, newMsg.GiftId, otherParams, platform, newMsg.ShowId, channel)
|
||||||
if newMsg != nil {
|
if newMsg != nil {
|
||||||
dbMsgs = append(dbMsgs, newMsg)
|
dbMsgs = append(dbMsgs, newMsg)
|
||||||
}
|
}
|
||||||
|
@ -4360,13 +4367,13 @@ func init() {
|
||||||
p := PlayerMgrSington.GetPlayerBySnId(msg.GetSnid())
|
p := PlayerMgrSington.GetPlayerBySnId(msg.GetSnid())
|
||||||
if p != nil {
|
if p != nil {
|
||||||
//获取道具Id
|
//获取道具Id
|
||||||
BagMgrSingleton.AddItems(p, items, 0, common.GainWayBackend, "system", "后台操作", 0, 0, false)
|
BagMgrSingleton.AddItems(p, items, 0, msg.GetTypeId(), "system", msg.GetRemark(), 0, 0, false)
|
||||||
pack.Tag = webapiproto.TagCode_SUCCESS
|
pack.Tag = webapiproto.TagCode_SUCCESS
|
||||||
pack.Msg = "AddItem success"
|
pack.Msg = "AddItem success"
|
||||||
return common.ResponseTag_Ok, pack
|
return common.ResponseTag_Ok, pack
|
||||||
} else {
|
} else {
|
||||||
BagMgrSingleton.AddItemsOffline(msg.Platform, msg.Snid, items, common.GainWayBackend,
|
BagMgrSingleton.AddItemsOffline(msg.Platform, msg.Snid, items, msg.GetTypeId(),
|
||||||
"system", "后台操作", 0, 0, false, func(err error) {
|
"system", msg.GetRemark(), 0, 0, false, func(err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
pack.Tag = webapiproto.TagCode_FAILED
|
pack.Tag = webapiproto.TagCode_FAILED
|
||||||
pack.Msg = "AddItem failed:" + err.Error()
|
pack.Msg = "AddItem failed:" + err.Error()
|
||||||
|
|
Loading…
Reference in New Issue