竞技馆获奖假数据
This commit is contained in:
parent
91bb5820f9
commit
7d8eaee2c2
|
@ -1,45 +0,0 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
rawproto "google.golang.org/protobuf/proto"
|
||||
"mongo.games.com/game/proto"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
"mongo.games.com/goserver/srvlib/protocol"
|
||||
)
|
||||
|
||||
func RegisterBoardCastHandler() {
|
||||
netlib.Register(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), &protocol.SSPacketBroadcast{}, BroadcastHandler)
|
||||
}
|
||||
|
||||
func BroadcastHandler(s *netlib.Session, packetId int, data interface{}) error {
|
||||
if bp, ok := data.(*protocol.SSPacketBroadcast); ok {
|
||||
pd := bp.GetData()
|
||||
sp := bp.GetSessParam()
|
||||
if bcss := sp.GetBcss(); bcss != nil {
|
||||
srvlib.ServerSessionMgrSington.Broadcast(int(bp.GetPacketId()), pd, int(bcss.GetSArea()), int(bcss.GetSType()))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func CreateBroadcastPacket(sp *protocol.BCSessionUnion, packetId int, data interface{}) (rawproto.Message, error) {
|
||||
pack := &protocol.SSPacketBroadcast{
|
||||
SessParam: sp,
|
||||
PacketId: proto.Int(packetId),
|
||||
}
|
||||
|
||||
if byteData, ok := data.([]byte); ok {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
byteData, err := netlib.MarshalPacket(packetId, data)
|
||||
if err == nil {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
logger.Logger.Warnf("CreateBroadcastPacket err:%v", err)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return pack, nil
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
rawproto "google.golang.org/protobuf/proto"
|
||||
"mongo.games.com/game/proto"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
"mongo.games.com/goserver/srvlib/protocol"
|
||||
)
|
||||
|
||||
func RegisterMulticastHandler() {
|
||||
netlib.Register(int(protocol.SrvlibPacketID_PACKET_SS_MULTICAST), &protocol.SSPacketMulticast{}, MulticastHandler)
|
||||
}
|
||||
|
||||
func MulticastHandler(s *netlib.Session, packetId int, data interface{}) error {
|
||||
if mp, ok := data.(*protocol.SSPacketMulticast); ok {
|
||||
pd := mp.GetData()
|
||||
sis := mp.GetSessions()
|
||||
for _, si := range sis {
|
||||
ss := si.GetMcss()
|
||||
if ss != nil {
|
||||
ns := srvlib.ServerSessionMgrSington.GetSession(int(ss.GetSArea()), int(ss.GetSType()), int(ss.GetSId()))
|
||||
if ns != nil {
|
||||
ns.Send(int(mp.GetPacketId()), pd /*, s.GetSessionConfig().IsInnerLink*/)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func CreateMulticastPacket(packetId int, data interface{}, sis ...*protocol.MCSessionUnion) (rawproto.Message, error) {
|
||||
pack := &protocol.SSPacketMulticast{
|
||||
Sessions: sis,
|
||||
PacketId: proto.Int(packetId),
|
||||
}
|
||||
if byteData, ok := data.([]byte); ok {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
byteData, err := netlib.MarshalPacket(packetId, data)
|
||||
if err == nil {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
logger.Logger.Errorf("CreateMulticastPacket err:%v", err)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return pack, nil
|
||||
}
|
|
@ -561,7 +561,6 @@ func init() {
|
|||
return nil
|
||||
}))
|
||||
|
||||
common.RegisterMulticastHandler()
|
||||
// 玩家离开
|
||||
//netlib.Register(int(server.SSPacketID_PACKET_WG_PlayerLEAVE), server.WGPlayerLeave{}, HandleWGPlayerLeave)
|
||||
// 同步记牌器过期时间
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package base
|
||||
|
||||
import (
|
||||
server_proto "mongo.games.com/game/protocol/server"
|
||||
"time"
|
||||
|
||||
"mongo.games.com/game/common"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/module"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
"mongo.games.com/goserver/srvlib/protocol"
|
||||
|
||||
"mongo.games.com/game/common"
|
||||
serverproto "mongo.games.com/game/protocol/server"
|
||||
)
|
||||
|
||||
var PlayerMgrSington = &PlayerMgr{
|
||||
|
@ -154,20 +154,8 @@ func (this *PlayerMgr) GetPlayerByAccount(acc string) *Player {
|
|||
// return nil
|
||||
//}
|
||||
|
||||
func (this *PlayerMgr) BroadcastMessage(packetid int, rawpack interface{}) bool {
|
||||
sc := &protocol.BCSessionUnion{
|
||||
Bccs: &protocol.BCClientSession{},
|
||||
}
|
||||
pack, err := common.CreateBroadcastPacket(sc, packetid, rawpack)
|
||||
if err == nil && pack != nil {
|
||||
srvlib.ServerSessionMgrSington.Broadcast(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), pack, common.GetSelfAreaId(), srvlib.GateServerType)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (this *PlayerMgr) BroadcastMessageToGroup(packetid int, rawpack interface{}, tags []string) bool {
|
||||
pack := &server_proto.SSCustomTagMulticast{
|
||||
pack := &serverproto.SSCustomTagMulticast{
|
||||
Tags: tags,
|
||||
}
|
||||
if byteData, ok := rawpack.([]byte); ok {
|
||||
|
@ -181,7 +169,7 @@ func (this *PlayerMgr) BroadcastMessageToGroup(packetid int, rawpack interface{}
|
|||
return false
|
||||
}
|
||||
}
|
||||
srvlib.ServerSessionMgrSington.Broadcast(int(server_proto.SSPacketID_PACKET_SS_CUSTOMTAG_MULTICAST), pack, common.GetSelfAreaId(), srvlib.GateServerType)
|
||||
srvlib.ServerSessionMgrSington.Broadcast(int(serverproto.SSPacketID_PACKET_SS_CUSTOMTAG_MULTICAST), pack, common.GetSelfAreaId(), srvlib.GateServerType)
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -4,15 +4,14 @@ import (
|
|||
"fmt"
|
||||
"math"
|
||||
"math/rand"
|
||||
"mongo.games.com/game/protocol/webapi"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
rawproto "google.golang.org/protobuf/proto"
|
||||
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/core/utils"
|
||||
"mongo.games.com/goserver/srvlib/action"
|
||||
srvlibproto "mongo.games.com/goserver/srvlib/protocol"
|
||||
|
||||
"mongo.games.com/game/common"
|
||||
|
@ -21,6 +20,7 @@ import (
|
|||
"mongo.games.com/game/protocol/gamehall"
|
||||
"mongo.games.com/game/protocol/player"
|
||||
"mongo.games.com/game/protocol/server"
|
||||
"mongo.games.com/game/protocol/webapi"
|
||||
"mongo.games.com/game/srvdata"
|
||||
)
|
||||
|
||||
|
@ -716,11 +716,7 @@ func (this *Scene) Broadcast(packetid int, msg rawproto.Message, excludeSid int6
|
|||
}
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := common.CreateMulticastPacket(packetid, msg, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
}
|
||||
action.MulticastMessageToServer(gateSess, packetid, msg, v...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -740,11 +736,7 @@ func (this *Scene) RobotBroadcast(packetid int, msg rawproto.Message) {
|
|||
}
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := common.CreateMulticastPacket(packetid, msg, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
}
|
||||
action.MulticastMessageToServer(gateSess, packetid, msg, v...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -765,11 +757,7 @@ func (this *Scene) BroadcastToAudience(packetid int, msg rawproto.Message) {
|
|||
}
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := common.CreateMulticastPacket(packetid, msg, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
}
|
||||
action.MulticastMessageToServer(gateSess, packetid, msg, v...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
package base
|
||||
|
||||
import (
|
||||
"mongo.games.com/game/common"
|
||||
"mongo.games.com/game/proto"
|
||||
"mongo.games.com/game/protocol/gamehall"
|
||||
"mongo.games.com/game/protocol/server"
|
||||
srvlibproto "mongo.games.com/goserver/srvlib/protocol"
|
||||
"time"
|
||||
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/module"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/srvlib/action"
|
||||
srvlibproto "mongo.games.com/goserver/srvlib/protocol"
|
||||
|
||||
"mongo.games.com/game/common"
|
||||
"mongo.games.com/game/proto"
|
||||
"mongo.games.com/game/protocol/gamehall"
|
||||
"mongo.games.com/game/protocol/server"
|
||||
)
|
||||
|
||||
var SceneMgrSington = &SceneMgr{
|
||||
|
@ -142,11 +144,7 @@ func (this *SceneMgr) JackPotSync(platform string, gameIds ...int32) {
|
|||
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
cPack, err := common.CreateMulticastPacket(int(gamehall.HundredScenePacketID_PACKET_SC_GAMEJACKPOT), pack, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(cPack)
|
||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), cPack)
|
||||
}
|
||||
action.MulticastMessageToServer(gateSess, int(gamehall.HundredScenePacketID_PACKET_SC_GAMEJACKPOT), pack, v...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,25 +2,27 @@ package fishing
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/cihub/seelog"
|
||||
"math"
|
||||
"math/rand"
|
||||
"mongo.games.com/game/gamesrv/base"
|
||||
fishing_proto "mongo.games.com/game/protocol/fishing"
|
||||
"mongo.games.com/game/srvdata"
|
||||
"mongo.games.com/goserver/core"
|
||||
"mongo.games.com/goserver/core/timer"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/cihub/seelog"
|
||||
"mongo.games.com/goserver/core"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/core/timer"
|
||||
"mongo.games.com/goserver/srvlib/action"
|
||||
srvlibproto "mongo.games.com/goserver/srvlib/protocol"
|
||||
|
||||
"mongo.games.com/game/common"
|
||||
"mongo.games.com/game/gamerule/fishing"
|
||||
"mongo.games.com/game/gamesrv/base"
|
||||
"mongo.games.com/game/model"
|
||||
"mongo.games.com/game/proto"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
srvlibproto "mongo.games.com/goserver/srvlib/protocol"
|
||||
fishing_proto "mongo.games.com/game/protocol/fishing"
|
||||
"mongo.games.com/game/srvdata"
|
||||
)
|
||||
|
||||
var fishlogger seelog.LoggerInterface
|
||||
|
@ -1457,11 +1459,7 @@ func (this *FishingSceneData) BroadCastMessage(packetid int, msg proto.Message,
|
|||
if gateSess == nil || len(v) == 0 {
|
||||
continue
|
||||
}
|
||||
pack, err := common.CreateMulticastPacket(packetid, msg, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
}
|
||||
action.MulticastMessageToServer(gateSess, packetid, msg, v...)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
"mongo.games.com/goserver/srvlib/protocol"
|
||||
)
|
||||
|
||||
func init() {
|
||||
netlib.Register(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), &protocol.SSPacketBroadcast{}, BroadcastHandler)
|
||||
}
|
||||
|
||||
func BroadcastHandler(s *netlib.Session, packetid int, data interface{}) error {
|
||||
if bp, ok := data.(*protocol.SSPacketBroadcast); ok {
|
||||
pd := bp.GetData()
|
||||
sp := bp.GetSessParam()
|
||||
if bcss := sp.GetBcss(); bcss != nil {
|
||||
srvlib.ServerSessionMgrSington.Broadcast(int(bp.GetPacketId()), pd, int(bcss.GetSArea()), int(bcss.GetSType()))
|
||||
} else {
|
||||
srvlib.ClientSessionMgrSington.Broadcast(int(bp.GetPacketId()), pd)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
"mongo.games.com/goserver/srvlib/protocol"
|
||||
)
|
||||
|
||||
func init() {
|
||||
netlib.Register(int(protocol.SrvlibPacketID_PACKET_SS_MULTICAST), &protocol.SSPacketMulticast{}, MulticastHandler)
|
||||
}
|
||||
|
||||
func MulticastHandler(s *netlib.Session, packetid int, data interface{}) error {
|
||||
if mp, ok := data.(*protocol.SSPacketMulticast); ok {
|
||||
pd := mp.GetData()
|
||||
sis := mp.GetSessions()
|
||||
for _, si := range sis {
|
||||
ns := getSession(si)
|
||||
if ns != nil {
|
||||
ns.Send(int(mp.GetPacketId()), pd /*, s.GetSessionConfig().IsInnerLink*/)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func getSession(su *protocol.MCSessionUnion) *netlib.Session {
|
||||
cs := su.GetMccs()
|
||||
if cs != nil {
|
||||
return srvlib.ClientSessionMgrSington.GetSession(cs.GetSId())
|
||||
}
|
||||
|
||||
ss := su.GetMcss()
|
||||
if ss != nil {
|
||||
return srvlib.ServerSessionMgrSington.GetSession(int(ss.GetSArea()), int(ss.GetSType()), int(ss.GetSId()))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"mongo.games.com/game/common"
|
||||
)
|
||||
|
||||
func init() {
|
||||
common.RegisterBoardCastHandler()
|
||||
}
|
|
@ -2,23 +2,25 @@ package api
|
|||
|
||||
import (
|
||||
"io"
|
||||
"mongo.games.com/game/common"
|
||||
"mongo.games.com/game/model"
|
||||
"mongo.games.com/game/proto"
|
||||
msg_proto "mongo.games.com/game/protocol/message"
|
||||
"mongo.games.com/game/protocol/server"
|
||||
"mongo.games.com/game/protocol/webapi"
|
||||
"net/http"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"mongo.games.com/goserver/core/admin"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/timer"
|
||||
"mongo.games.com/goserver/core/utils"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
"mongo.games.com/goserver/srvlib/action"
|
||||
"mongo.games.com/goserver/srvlib/protocol"
|
||||
srvlibprotocol "mongo.games.com/goserver/srvlib/protocol"
|
||||
"net/http"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"mongo.games.com/game/common"
|
||||
"mongo.games.com/game/model"
|
||||
"mongo.games.com/game/proto"
|
||||
msgproto "mongo.games.com/game/protocol/message"
|
||||
"mongo.games.com/game/protocol/server"
|
||||
"mongo.games.com/game/protocol/webapi"
|
||||
)
|
||||
|
||||
//-------------------------------切换状态-------------------------------------------------------
|
||||
|
@ -225,20 +227,8 @@ func SrvCtrlNotice(rw http.ResponseWriter, data []byte) {
|
|||
noticePacket := &server.ServerNotice{
|
||||
Text: proto.String(msg.GetNotice()),
|
||||
}
|
||||
proto.SetDefaults(noticePacket)
|
||||
sc := &protocol.BCSessionUnion{
|
||||
Bccs: &protocol.BCClientSession{},
|
||||
}
|
||||
broadcast, err := common.CreateBroadcastPacket(sc, int(msg_proto.MSGPacketID_PACKET_SC_NOTICE), noticePacket)
|
||||
if err != nil || broadcast == nil {
|
||||
pack.Tag = webapi.TagCode_FAILED
|
||||
pack.Msg = "send notice failed(inner error)"
|
||||
r, _ := proto.Marshal(pack)
|
||||
webApiResponse(rw, r)
|
||||
return
|
||||
}
|
||||
funcNotice := func() {
|
||||
srvlib.ServerSessionMgrSington.Broadcast(int(srvlibprotocol.SrvlibPacketID_PACKET_SS_BROADCAST), broadcast, common.GetSelfAreaId(), srvlib.GateServerType)
|
||||
action.BroadcastMessage(common.GetSelfAreaId(), srvlib.GateServerType, int(msgproto.MSGPacketID_PACKET_SC_NOTICE), noticePacket, &protocol.BCSessionUnion{})
|
||||
}
|
||||
funcNotice()
|
||||
h, b := timer.StartTimer(timer.TimerActionWrapper(func(h timer.TimerHandle, ud interface{}) bool {
|
||||
|
|
|
@ -85,6 +85,8 @@ type GameParam struct {
|
|||
GuideStepMaxNum int32 // 新手引导步骤最大值
|
||||
GuideTs int64 // 新手引导时间戳,小于这个时间的玩家不显示新手引导
|
||||
CustomAwardUpdateTime int // 竞技馆奖励更新时间
|
||||
CustomAwardMinAddTime int // 竞技馆假奖励方法周期,单位秒
|
||||
CustomAwardMaxAddTime int // 竞技馆假奖励方法周期,单位秒
|
||||
}
|
||||
|
||||
var GameParamPath = "../data/gameparam.json"
|
||||
|
@ -221,4 +223,10 @@ func InitGameParam() {
|
|||
if GameParamData.CustomAwardUpdateTime == 0 {
|
||||
GameParamData.CustomAwardUpdateTime = 60
|
||||
}
|
||||
if GameParamData.CustomAwardMinAddTime == 0 {
|
||||
GameParamData.CustomAwardMinAddTime = 20 * 60
|
||||
}
|
||||
if GameParamData.CustomAwardMaxAddTime == 0 {
|
||||
GameParamData.CustomAwardMaxAddTime = 30 * 60
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ const (
|
|||
// 竞技馆获奖记录
|
||||
Rank_PACKET_CSRoomAward Rank = 10014
|
||||
Rank_PACKET_SCRoomAward Rank = 10015
|
||||
Rank_PACKET_SCRoomAwardOne Rank = 10016 // 竞技馆获奖记录通知
|
||||
)
|
||||
|
||||
// Enum value maps for Rank.
|
||||
|
@ -70,6 +71,7 @@ var (
|
|||
10013: "PACKET_RANK_SCPermit",
|
||||
10014: "PACKET_CSRoomAward",
|
||||
10015: "PACKET_SCRoomAward",
|
||||
10016: "PACKET_SCRoomAwardOne",
|
||||
}
|
||||
Rank_value = map[string]int32{
|
||||
"PACKET_RANK_ZERO": 0,
|
||||
|
@ -89,6 +91,7 @@ var (
|
|||
"PACKET_RANK_SCPermit": 10013,
|
||||
"PACKET_CSRoomAward": 10014,
|
||||
"PACKET_SCRoomAward": 10015,
|
||||
"PACKET_SCRoomAwardOne": 10016,
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -1907,6 +1910,7 @@ func (x *Item) GetN() int64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
// PACKET_SCRoomAwardOne
|
||||
type UserAward struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -2235,7 +2239,7 @@ var file_rank_proto_rawDesc = []byte{
|
|||
0x6b, 0x69, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x05, 0x52, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f, 0x74,
|
||||
0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x2a,
|
||||
0xc6, 0x03, 0x0a, 0x04, 0x52, 0x61, 0x6e, 0x6b, 0x12, 0x14, 0x0a, 0x10, 0x50, 0x41, 0x43, 0x4b,
|
||||
0xe2, 0x03, 0x0a, 0x04, 0x52, 0x61, 0x6e, 0x6b, 0x12, 0x14, 0x0a, 0x10, 0x50, 0x41, 0x43, 0x4b,
|
||||
0x45, 0x54, 0x5f, 0x52, 0x41, 0x4e, 0x4b, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x1c,
|
||||
0x0a, 0x17, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x52, 0x41, 0x4e, 0x4b, 0x5f, 0x43, 0x53,
|
||||
0x52, 0x61, 0x6e, 0x6b, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x10, 0x90, 0x4e, 0x12, 0x1c, 0x0a, 0x17,
|
||||
|
@ -2263,19 +2267,21 @@ var file_rank_proto_rawDesc = []byte{
|
|||
0x6d, 0x69, 0x74, 0x10, 0x9d, 0x4e, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54,
|
||||
0x5f, 0x43, 0x53, 0x52, 0x6f, 0x6f, 0x6d, 0x41, 0x77, 0x61, 0x72, 0x64, 0x10, 0x9e, 0x4e, 0x12,
|
||||
0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x52, 0x6f, 0x6f, 0x6d,
|
||||
0x41, 0x77, 0x61, 0x72, 0x64, 0x10, 0x9f, 0x4e, 0x2a, 0x8d, 0x01, 0x0a, 0x0a, 0x52, 0x61, 0x6e,
|
||||
0x6b, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x12, 0x13, 0x0a, 0x0f, 0x49, 0x6e, 0x76, 0x69, 0x74,
|
||||
0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10,
|
||||
0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x6f, 0x74, 0x61, 0x6c,
|
||||
0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65,
|
||||
0x5f, 0x57, 0x65, 0x65, 0x6b, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x49, 0x6e, 0x76, 0x69, 0x74,
|
||||
0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4d, 0x6f, 0x6e, 0x74, 0x68, 0x10, 0x03, 0x12, 0x15, 0x0a,
|
||||
0x11, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x55, 0x70, 0x57, 0x65,
|
||||
0x65, 0x6b, 0x10, 0x04, 0x12, 0x12, 0x0a, 0x0e, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x54, 0x79,
|
||||
0x70, 0x65, 0x5f, 0x4d, 0x61, 0x78, 0x10, 0x05, 0x42, 0x24, 0x5a, 0x22, 0x6d, 0x6f, 0x6e, 0x67,
|
||||
0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65,
|
||||
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x72, 0x61, 0x6e, 0x6b, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x41, 0x77, 0x61, 0x72, 0x64, 0x10, 0x9f, 0x4e, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b,
|
||||
0x45, 0x54, 0x5f, 0x53, 0x43, 0x52, 0x6f, 0x6f, 0x6d, 0x41, 0x77, 0x61, 0x72, 0x64, 0x4f, 0x6e,
|
||||
0x65, 0x10, 0xa0, 0x4e, 0x2a, 0x8d, 0x01, 0x0a, 0x0a, 0x52, 0x61, 0x6e, 0x6b, 0x49, 0x6e, 0x76,
|
||||
0x69, 0x74, 0x65, 0x12, 0x13, 0x0a, 0x0f, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x54, 0x79, 0x70,
|
||||
0x65, 0x5f, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x49, 0x6e, 0x76, 0x69,
|
||||
0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x10, 0x01, 0x12, 0x13,
|
||||
0x0a, 0x0f, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x57, 0x65, 0x65,
|
||||
0x6b, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x54, 0x79, 0x70,
|
||||
0x65, 0x5f, 0x4d, 0x6f, 0x6e, 0x74, 0x68, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x49, 0x6e, 0x76,
|
||||
0x69, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x55, 0x70, 0x57, 0x65, 0x65, 0x6b, 0x10, 0x04,
|
||||
0x12, 0x12, 0x0a, 0x0e, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4d,
|
||||
0x61, 0x78, 0x10, 0x05, 0x42, 0x24, 0x5a, 0x22, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61,
|
||||
0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x72, 0x61, 0x6e, 0x6b, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
|
@ -28,6 +28,7 @@ enum Rank{
|
|||
// 竞技馆获奖记录
|
||||
PACKET_CSRoomAward = 10014;
|
||||
PACKET_SCRoomAward = 10015;
|
||||
PACKET_SCRoomAwardOne = 10016; // 竞技馆获奖记录通知
|
||||
}
|
||||
|
||||
// 排位榜
|
||||
|
@ -223,6 +224,7 @@ message Item{
|
|||
int64 N = 2; // 道具数量
|
||||
}
|
||||
|
||||
// PACKET_SCRoomAwardOne
|
||||
message UserAward{
|
||||
int32 Snid = 1; // 玩家id
|
||||
string Name = 2; // 昵称
|
||||
|
|
|
@ -6,17 +6,27 @@ import (
|
|||
"go.etcd.io/etcd/client/v3"
|
||||
|
||||
"mongo.games.com/game/etcd"
|
||||
"mongo.games.com/game/model"
|
||||
"mongo.games.com/game/protocol/webapi"
|
||||
)
|
||||
|
||||
var ConfigMgrInst = model.NewConfigMgr()
|
||||
|
||||
func init() {
|
||||
// 平台信息
|
||||
etcd.Register(etcd.ETCDKEY_PLATFORM_PREFIX, webapi.Platform{}, PlatformConfigEtcd)
|
||||
// 竞技馆房间配置
|
||||
etcd.Register(etcd.ETCDKEY_RoomConfig, webapi.RoomConfig{}, PlatformConfigEtcd)
|
||||
}
|
||||
|
||||
func PlatformConfigEtcd(ctx context.Context, completeKey string, isInit bool, event *clientv3.Event, data interface{}) {
|
||||
if event.Type == clientv3.EventTypeDelete {
|
||||
return
|
||||
}
|
||||
PlatformConfigSingleton.Update(data)
|
||||
switch config := data.(type) {
|
||||
case *webapi.Platform:
|
||||
PlatformConfigSingleton.Update(config)
|
||||
case *webapi.RoomConfig:
|
||||
ConfigMgrInst.UpdateRoomConfig(config)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package com
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
|
||||
"mongo.games.com/game/model"
|
||||
"mongo.games.com/game/mq"
|
||||
)
|
||||
|
||||
// LogChannelSingleton 日志记录器
|
||||
var LogChannelSingleton = &LogChannel{
|
||||
cName: make(map[reflect.Type]string),
|
||||
}
|
||||
|
||||
type LogChannel struct {
|
||||
cName map[reflect.Type]string
|
||||
}
|
||||
|
||||
func (c *LogChannel) RegisterLogCName(cname string, log interface{}) {
|
||||
t := c.getLogType(log)
|
||||
c.cName[t] = cname
|
||||
}
|
||||
|
||||
func (c *LogChannel) getLogType(log interface{}) reflect.Type {
|
||||
return reflect.Indirect(reflect.ValueOf(log)).Type()
|
||||
}
|
||||
|
||||
func (c *LogChannel) getLogCName(log interface{}) string {
|
||||
t := c.getLogType(log)
|
||||
if name, exist := c.cName[t]; exist {
|
||||
return name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (c *LogChannel) WriteLog(log interface{}) {
|
||||
cname := c.getLogCName(log)
|
||||
if cname == "" {
|
||||
cname = "_null_"
|
||||
}
|
||||
logger.Logger.Tracef("LogChannel ==> %#v", log)
|
||||
mq.Send(cname, log)
|
||||
}
|
||||
|
||||
func (c *LogChannel) WriteMQData(data *model.RabbitMQData) {
|
||||
mq.Send(data.MQName, data.Data)
|
||||
}
|
||||
|
||||
func init() {
|
||||
LogChannelSingleton.RegisterLogCName(mq.DBCustomLogAward, &model.CustomLogAward{})
|
||||
}
|
|
@ -23,6 +23,7 @@ func main() {
|
|||
core.RegisteHook(core.HOOK_BEFORE_START, func() error {
|
||||
model.StartupRPClient(common.CustomConfig.GetString("MgoRpcCliNet"), common.CustomConfig.GetString("MgoRpcCliAddr"), time.Duration(common.CustomConfig.GetInt("MgoRpcCliReconnInterV"))*time.Second)
|
||||
mq.StartConsumer(common.CustomConfig.GetString("RabbitMQURL"), common.CustomConfig.GetString("RMQExchange"), true)
|
||||
mq.StartPublisher(common.CustomConfig.GetString("RabbitMQURL"), common.CustomConfig.GetString("RMQExchange"), true, common.CustomConfig.GetInt("RMQPublishBacklog"))
|
||||
err := model.InitGameKVData()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
package rank
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"github.com/jinzhu/now"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/module"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
"mongo.games.com/goserver/srvlib/action"
|
||||
|
||||
"mongo.games.com/game/common"
|
||||
"mongo.games.com/game/model"
|
||||
"mongo.games.com/game/protocol/rank"
|
||||
"mongo.games.com/game/ranksrv/com"
|
||||
"mongo.games.com/game/srvdata"
|
||||
)
|
||||
|
||||
var CustomAwardMgrInstance = com.NewListMgr[*model.CustomLogAward](
|
||||
|
@ -22,3 +29,79 @@ var CustomAwardMgrInstance = com.NewListMgr[*model.CustomLogAward](
|
|||
ret, err := model.CustomLogAwardFind(platform, startTs, endTs)
|
||||
return ret, err
|
||||
})
|
||||
|
||||
var CustomAwardMgrSingle = &CustomAwardMgr{}
|
||||
|
||||
type CustomAwardMgr struct {
|
||||
updateTime time.Time
|
||||
}
|
||||
|
||||
func (c *CustomAwardMgr) ModuleName() string {
|
||||
return "customaward"
|
||||
}
|
||||
|
||||
func (c *CustomAwardMgr) Init() {
|
||||
}
|
||||
|
||||
func (c *CustomAwardMgr) Update() {
|
||||
nowTime := time.Now()
|
||||
if nowTime.Unix() < c.updateTime.Unix() {
|
||||
return
|
||||
}
|
||||
c.updateTime = nowTime.Add(time.Duration(common.RandInt(model.GameParamData.CustomAwardMinAddTime, model.GameParamData.CustomAwardMaxAddTime)) * time.Second)
|
||||
|
||||
// 随机添加假数据
|
||||
for k := range com.PlatformConfigSingleton.Platforms {
|
||||
for _, vv := range com.ConfigMgrInst.GetConfig(k).RoomConfig {
|
||||
if vv.GetOn() == common.Off {
|
||||
continue
|
||||
}
|
||||
var awards []*model.Item
|
||||
var items []*rank.Item
|
||||
for _, item := range vv.GetReward() {
|
||||
awards = append(awards, &model.Item{
|
||||
ItemId: item.ItemId,
|
||||
ItemNum: item.ItemNum,
|
||||
ObtainTime: nowTime.Unix(),
|
||||
})
|
||||
items = append(items, &rank.Item{
|
||||
Id: item.ItemId,
|
||||
N: item.ItemNum,
|
||||
})
|
||||
}
|
||||
name := ""
|
||||
if len(srvdata.PBDB_NameMgr.Datas.GetArr()) > 0 {
|
||||
n := rand.Intn(len(srvdata.PBDB_NameMgr.Datas.GetArr()))
|
||||
name = srvdata.PBDB_NameMgr.Datas.GetArr()[n].Name
|
||||
}
|
||||
id := common.RandInt(20000000, 99999999)
|
||||
com.LogChannelSingleton.WriteLog(&model.CustomLogAward{
|
||||
Platform: k,
|
||||
CycleId: "",
|
||||
SnId: int32(id),
|
||||
Name: name,
|
||||
Awards: awards,
|
||||
StartTs: nowTime.Add(-time.Minute * 8).Unix(),
|
||||
EndTs: nowTime.Unix(),
|
||||
})
|
||||
// 通知获奖
|
||||
pack := &rank.UserAward{
|
||||
Snid: int32(id),
|
||||
Name: name,
|
||||
Awards: items,
|
||||
Ts: nowTime.Unix(),
|
||||
}
|
||||
action.BroadcastMessage(common.GetSelfAreaId(), srvlib.GateServerType, int(rank.Rank_PACKET_SCRoomAwardOne), pack, nil)
|
||||
logger.Logger.Tracef("BroadcastMessage UserAward: %v", pack)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (c *CustomAwardMgr) Shutdown() {
|
||||
module.UnregisteModule(c)
|
||||
}
|
||||
|
||||
func init() {
|
||||
module.RegisteModule(CustomAwardMgrSingle, time.Second*5, 0)
|
||||
}
|
||||
|
|
|
@ -694,9 +694,6 @@ func (this *CSAccountInvalidHandler) Process(s *netlib.Session, packetid int, da
|
|||
}
|
||||
|
||||
func init() {
|
||||
common.RegisterBoardCastHandler()
|
||||
common.RegisterMulticastHandler()
|
||||
|
||||
common.RegisterHandler(int(playerproto.PlayerPacketID_PACKET_CS_PMCMD), &CSPMCmdHandler{})
|
||||
netlib.RegisterFactory(int(playerproto.PlayerPacketID_PACKET_CS_PMCMD), &CSPMCmdPacketFactory{})
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"mongo.games.com/game/proto"
|
||||
"mongo.games.com/game/srvdata"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/srvlib/action"
|
||||
srvproto "mongo.games.com/goserver/srvlib/protocol"
|
||||
)
|
||||
|
||||
|
@ -75,11 +76,7 @@ func (gsm *GameStateManager) BrodcastGameState(gameId int32, platform string, pa
|
|||
}
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := common.CreateMulticastPacket(packid, pack, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
}
|
||||
action.MulticastMessageToServer(gateSess, packid, pack, v...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"mongo.games.com/goserver/core/module"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/core/utils"
|
||||
"mongo.games.com/goserver/srvlib/action"
|
||||
srvlibproto "mongo.games.com/goserver/srvlib/protocol"
|
||||
|
||||
"mongo.games.com/game/common"
|
||||
|
@ -301,10 +302,7 @@ func (pm *PlatformMgr) Broadcast(packetid int, packet interface{}, players map[i
|
|||
}
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := common.CreateMulticastPacket(packetid, packet, v...)
|
||||
if err == nil {
|
||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
}
|
||||
action.MulticastMessageToServer(gateSess, packetid, packet, v...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import (
|
|||
"mongo.games.com/goserver/core/task"
|
||||
"mongo.games.com/goserver/core/utils"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
"mongo.games.com/goserver/srvlib/action"
|
||||
srvproto "mongo.games.com/goserver/srvlib/protocol"
|
||||
|
||||
"mongo.games.com/game/common"
|
||||
|
@ -290,14 +291,8 @@ func (this *PlayerMgr) UpdatePlayerToken(p *Player, newToken string) {
|
|||
|
||||
// BroadcastMessage 给所有玩家发消息
|
||||
func (this *PlayerMgr) BroadcastMessage(packetid int, rawpack interface{}) bool {
|
||||
sc := &srvproto.BCSessionUnion{
|
||||
Bccs: &srvproto.BCClientSession{},
|
||||
}
|
||||
pack, err := common.CreateBroadcastPacket(sc, packetid, rawpack)
|
||||
if err == nil && pack != nil {
|
||||
srvlib.ServerSessionMgrSington.Broadcast(int(srvproto.SrvlibPacketID_PACKET_SS_BROADCAST), pack, common.GetSelfAreaId(), srvlib.GateServerType)
|
||||
return true
|
||||
}
|
||||
sc := &srvproto.BCSessionUnion{}
|
||||
action.BroadcastMessage(common.GetSelfAreaId(), srvlib.GateServerType, packetid, rawpack, sc)
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -319,11 +314,7 @@ func (this *PlayerMgr) BroadcastMessageToPlatform(platform string, packetid int,
|
|||
}
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := common.CreateMulticastPacket(packetid, rawpack, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
}
|
||||
action.MulticastMessageToServer(gateSess, packetid, rawpack, v...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -361,11 +352,7 @@ func (this *PlayerMgr) BroadcastMessageToPlatformByFunc(platform string, packeti
|
|||
}
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := common.CreateMulticastPacket(packetid, rawpack, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
}
|
||||
action.MulticastMessageToServer(gateSess, packetid, rawpack, v...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -394,11 +381,7 @@ func (this *PlayerMgr) BroadcastMessageToPlatformWithHall(platform string, snid
|
|||
}
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := common.CreateMulticastPacket(packetid, rawpack, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
}
|
||||
action.MulticastMessageToServer(gateSess, packetid, rawpack, v...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -441,11 +424,7 @@ func (this *PlayerMgr) BroadcastMessageToTarget(target []int32, packetid int, ra
|
|||
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := common.CreateMulticastPacket(packetid, rawpack, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
}
|
||||
action.MulticastMessageToServer(gateSess, packetid, rawpack, v...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
"mongo.games.com/goserver/srvlib/action"
|
||||
srvlibproto "mongo.games.com/goserver/srvlib/protocol"
|
||||
|
||||
"mongo.games.com/game/common"
|
||||
|
@ -864,11 +865,7 @@ func (this *Scene) Broadcast(packetId int, msg rawproto.Message, excludeSid int6
|
|||
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := common.CreateMulticastPacket(packetId, msg, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
}
|
||||
action.MulticastMessageToServer(gateSess, packetId, msg, v...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/core/timer"
|
||||
"mongo.games.com/goserver/srvlib/action"
|
||||
srvproto "mongo.games.com/goserver/srvlib/protocol"
|
||||
|
||||
"mongo.games.com/game/common"
|
||||
|
@ -112,11 +113,7 @@ func (tm *TmMatch) BroadcastMessage(packetId int, rawPack interface{}) {
|
|||
}
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := common.CreateMulticastPacket(packetId, rawPack, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
}
|
||||
action.MulticastMessageToServer(gateSess, packetId, rawPack, v...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue