game_sync/robot/base/interaction.go

59 lines
1.0 KiB
Go

package base
import (
"math/rand"
"mongo.games.com/game/protocol/gamehall"
"mongo.games.com/goserver/core/netlib"
)
// 机器人互动操作
const (
none = -1
weixiao_01 = iota - 1
kaixin_02
kuqi_03
nanweiren_04
aini_05
dengyan_06
ganga_07
dahan_08
fahuo_09
maren_10
mihu_11
wulianxiao_12
shuashuai_13
haixiu_14
aixin_15
buai_16
zan_17
daozan_18
woshou_19
ok_20
fo_21
)
var (
Emote1 = []int{fahuo_09, dahan_08, nanweiren_04, dengyan_06, mihu_11, none}
Emote2 = []int{weixiao_01, dengyan_06, mihu_11, mihu_11, none}
Emote3 = []int{dengyan_06, fahuo_09, ganga_07, none}
Emote4 = []int{aini_05, wulianxiao_12, shuashuai_13, none}
Emote5 = []int{shuashuai_13, wulianxiao_12, none}
)
// SendEmote 随机表情
func SendEmote(s *netlib.Session, arr []int) {
e := arr[rand.Intn(len(arr))] // 随机一个表情
if e == -1 {
return
}
pack := &gamehall.CSRoomEvent{
Tp: 2,
Content: "",
Param: []int32{int32(e)},
}
DelaySendSecond(s, int(gamehall.GameHallPacketID_PACKET_CSRoomEvent), pack, 3, 5)
}