机器人互动表情

This commit is contained in:
sk 2024-04-28 14:59:13 +08:00
parent 2e6928f317
commit cc4125fee5
4 changed files with 30 additions and 9 deletions

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

@ -12,12 +12,16 @@ var TienLenNilPlayer *TienLenPlayer = nil
type TienLenPlayer struct { type TienLenPlayer struct {
base.BasePlayer base.BasePlayer
*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) {