Compare commits

...

2 Commits

Author SHA1 Message Date
sk cc4125fee5 机器人互动表情 2024-04-28 14:59:13 +08:00
sk 2e6928f317 添加渠道信息 2024-04-28 11:45:43 +08:00
7 changed files with 34 additions and 21 deletions

View File

@ -3,11 +3,6 @@ package model
import "time" import "time"
import "github.com/globalsign/mgo/bson" import "github.com/globalsign/mgo/bson"
// 破产次数统计
var (
BankruptLogCollName = "log_bankrupt"
)
// 破产次数统计 // 破产次数统计
type BankruptLog struct { type BankruptLog struct {
LogId bson.ObjectId `bson:"_id"` LogId bson.ObjectId `bson:"_id"`

View File

@ -3,16 +3,12 @@ package model
import "time" import "time"
import "github.com/globalsign/mgo/bson" import "github.com/globalsign/mgo/bson"
// 破产金领取详情
var (
ReliefFundLogCollName = "log_relieffund"
)
// 破产金领取详情 // 破产金领取详情
type ReliefFundLog struct { type ReliefFundLog struct {
LogId bson.ObjectId `bson:"_id"` LogId bson.ObjectId `bson:"_id"`
SnId int32 //玩家id SnId int32 //玩家id
Platform string //平台名称 Platform string //平台名称
Channel string // 渠道
CreateTime int64 // 注册时间 CreateTime int64 // 注册时间
Ts int64 // 领取时间 Ts int64 // 领取时间
@ -26,10 +22,11 @@ func NewReliefFundLog() *ReliefFundLog {
return log return log
} }
func NewReliefFundLogEx(snid int32, gettype, cointype int32, getamount, createtime int64, platform string) *ReliefFundLog { func NewReliefFundLogEx(snid int32, gettype, cointype int32, getamount, createtime int64, platform, channel string) *ReliefFundLog {
cl := NewReliefFundLog() cl := NewReliefFundLog()
cl.SnId = snid cl.SnId = snid
cl.Platform = platform cl.Platform = platform
cl.Channel = channel
now := time.Now() now := time.Now()
cl.Ts = now.Unix() cl.Ts = now.Unix()

View File

@ -54,5 +54,5 @@ func SendEmote(s *netlib.Session, p IPlayer, arr []int) {
Param: []int32{int32(e)}, Param: []int32{int32(e)},
} }
DelaySendSecond(s, int(gamehall.GameHallPacketID_PACKET_CSRoomEvent), pack, 2, 3) DelaySendSecond(s, int(gamehall.GameHallPacketID_PACKET_CSRoomEvent), pack, 3, 5)
} }

View File

@ -47,6 +47,13 @@ func (sm *SceneMgr) GetSceneDBGameFree(sceneId, gamefreeId int32) *server_proto.
return srvdata.PBDB_GameFreeMgr.GetData(gamefreeId) return srvdata.PBDB_GameFreeMgr.GetData(gamefreeId)
} }
func (sm *SceneMgr) IsFreeMode(sceneId int32) bool {
if data, exist := sm.sceneDBGameFree[sceneId]; exist {
return data.GetFreeMode() == 1
}
return false
}
// ////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////
// / Module Implement [beg] // / Module Implement [beg]
// ////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////

View File

@ -20,6 +20,15 @@ import (
"strings" "strings"
) )
func SendEmote(s *netlib.Session, scene *TienLenScene, p *TienLenPlayer, arr []int, tp int) {
if !base.SceneMgrSingleton.IsFreeMode(scene.GetRoomId()) && !scene.IsMatchScene() {
if p.EmoteTimes[tp] == 0 {
base.SendEmote(s, p, arr)
}
p.EmoteTimes[tp]++
}
}
type SCTienLenRoomInfoPacketFactory struct { type SCTienLenRoomInfoPacketFactory struct {
} }
@ -95,7 +104,7 @@ func (this *SCTienLenPlayerOpHandler) Process(s *netlib.Session, packid int, pac
if lastPlayer != nil && lastPlayer.IsRobot() && me.SnId != lastPlayer.GetSnId() && if lastPlayer != nil && lastPlayer.IsRobot() && me.SnId != lastPlayer.GetSnId() &&
(tienlen.IsTwo(scene.LastCards) || tienlen.IsBomb(scene.LastCards, !common.IsTienLenYuLe(int(scene.GetGameId())))) { (tienlen.IsTwo(scene.LastCards) || tienlen.IsBomb(scene.LastCards, !common.IsTienLenYuLe(int(scene.GetGameId())))) {
// 机器人出2/炸弹被压制 // 机器人出2/炸弹被压制
base.SendEmote(base.PlayerMgrSingleton.GetPlayerSession(scene.LastOpSnid), lastPlayer, base.Emote1) SendEmote(base.PlayerMgrSingleton.GetPlayerSession(scene.LastOpSnid), scene, lastPlayer.(*TienLenPlayer), base.Emote1, 1)
} }
scene.LastCards = delC scene.LastCards = delC
scene.LastOpSnid = me.SnId scene.LastOpSnid = me.SnId
@ -105,7 +114,7 @@ func (this *SCTienLenPlayerOpHandler) Process(s *netlib.Session, packid int, pac
if me.PassTimes >= 2 { if me.PassTimes >= 2 {
me.PassTimes = 0 me.PassTimes = 0
// 机器人过牌两次 // 机器人过牌两次
base.SendEmote(s, me, base.Emote2) SendEmote(s, scene, me, base.Emote2, 2)
} }
} }
@ -461,7 +470,7 @@ func (this *SCTienLenCurOpPosHandler) Process(s *netlib.Session, packid int, pac
minS = notExDelayminS minS = notExDelayminS
maxS = notExDelaymaxS maxS = notExDelaymaxS
if scene.FirstWinSnid == 0 { if scene.FirstWinSnid == 0 {
base.SendEmote(s, p, base.Emote5) SendEmote(s, scene, me, base.Emote5, 5)
scene.FirstWinSnid = me.SnId scene.FirstWinSnid = me.SnId
} }
} }
@ -628,9 +637,9 @@ func SCRoomEvent(s *netlib.Session, packid int, pack interface{}) error {
switch msg.Param[0] { switch msg.Param[0] {
case common.ItemIDBucket, common.ItemIDSlippers: case common.ItemIDBucket, common.ItemIDSlippers:
base.SendEmote(s, p, base.Emote3) SendEmote(s, scene, p.(*TienLenPlayer), base.Emote3, 3)
case common.ItemIDLike, common.ItemIDCoffee: case common.ItemIDLike, common.ItemIDCoffee:
base.SendEmote(s, p, base.Emote4) SendEmote(s, scene, p.(*TienLenPlayer), base.Emote4, 3)
} }
return nil return nil

View File

@ -14,10 +14,14 @@ type TienLenPlayer struct {
*proto_tienlen.TienLenPlayerData *proto_tienlen.TienLenPlayerData
data *tienlenApi.PredictRequest data *tienlenApi.PredictRequest
PassTimes int PassTimes int
EmoteTimes map[int]int // 事件触发次数
} }
func NewTienLenPlayer(data *proto_tienlen.TienLenPlayerData) *TienLenPlayer { func NewTienLenPlayer(data *proto_tienlen.TienLenPlayerData) *TienLenPlayer {
p := &TienLenPlayer{TienLenPlayerData: data} p := &TienLenPlayer{
TienLenPlayerData: data,
EmoteTimes: make(map[int]int),
}
p.Init() p.Init()
return p return p
} }
@ -28,6 +32,7 @@ func (p *TienLenPlayer) Init() {
func (p *TienLenPlayer) Clear() { func (p *TienLenPlayer) Clear() {
p.PassTimes = 0 p.PassTimes = 0
p.EmoteTimes = make(map[int]int)
} }
func (p *TienLenPlayer) MarkFlag(flag int32) { func (p *TienLenPlayer) MarkFlag(flag int32) {

View File

@ -111,7 +111,7 @@ func (this *WelfareMgr) GetReliefFund(p *Player, isVideo bool) {
getType = model.SystemFreeGive_GiveType_ShopAd getType = model.SystemFreeGive_GiveType_ShopAd
} }
log := model.NewReliefFundLogEx(p.SnId, getType, model.SystemFreeGive_CoinType_Coin, coin, p.CreateTime.Unix(), p.Platform) log := model.NewReliefFundLogEx(p.SnId, getType, model.SystemFreeGive_CoinType_Coin, coin, p.CreateTime.Unix(), p.Platform, p.Channel)
if log != nil { if log != nil {
LogChannelSingleton.WriteLog(log) LogChannelSingleton.WriteLog(log)
logger.Logger.Tracef("NewReliefFundLogEx WriteLog snid: %v Coin:%v", p.SnId, pack.Coin) logger.Logger.Tracef("NewReliefFundLogEx WriteLog snid: %v Coin:%v", p.SnId, pack.Coin)