From fd14654c59f8b95c2a18217fb560c6de0826e879 Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Fri, 27 Sep 2024 18:02:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=9E=E6=8A=80=E9=A6=86=E5=92=8C=E6=AF=94?= =?UTF-8?q?=E8=B5=9B=E5=9C=BA=E5=85=B3=E9=97=AD=E6=96=97=E9=B8=A1=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/clock.go | 18 ++++++++++------- common/comm.go | 29 ++++++++++------------------ gamesrv/tienlen/scenedata_tienlen.go | 2 +- worldsrv/player.go | 19 ------------------ 4 files changed, 22 insertions(+), 46 deletions(-) diff --git a/common/clock.go b/common/clock.go index cd68c9e..7245ee5 100644 --- a/common/clock.go +++ b/common/clock.go @@ -6,6 +6,10 @@ import ( "mongo.games.com/goserver/core/module" ) +/* + 时钟 +*/ + func init() { module.RegisteModule(ClockMgrSingleton, time.Millisecond*500, 0) } @@ -247,25 +251,25 @@ func RegisterClockFunc(fs *ClockFunc) { return } if fs.OnSecTimerFunc != nil { - fs.event = fs.event ^ ClockEventSecond + fs.event = fs.event | ClockEventSecond } if fs.OnMiniTimerFunc != nil { - fs.event = fs.event ^ ClockEventMinute + fs.event = fs.event | ClockEventMinute } if fs.OnHourTimerFunc != nil { - fs.event = fs.event ^ ClockEventHour + fs.event = fs.event | ClockEventHour } if fs.OnDayTimerFunc != nil { - fs.event = fs.event ^ ClockEventDay + fs.event = fs.event | ClockEventDay } if fs.OnWeekTimerFunc != nil { - fs.event = fs.event ^ ClockEventWeek + fs.event = fs.event | ClockEventWeek } if fs.OnMonthTimerFunc != nil { - fs.event = fs.event ^ ClockEventMonth + fs.event = fs.event | ClockEventMonth } if fs.OnShutdownFunc != nil { - fs.event = fs.event ^ ClockEventShutdown + fs.event = fs.event | ClockEventShutdown } ClockMgrSingleton.RegisterSinker(fs) diff --git a/common/comm.go b/common/comm.go index e36b436..e7563b2 100644 --- a/common/comm.go +++ b/common/comm.go @@ -6,7 +6,6 @@ import ( protocol_game "mongo.games.com/game/protocol/server" "mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/netlib" - "mongo.games.com/goserver/srvlib" "mongo.games.com/goserver/srvlib/protocol" ) @@ -45,11 +44,11 @@ func createMulticastPacket(packetid int, data interface{}, sis ...*protocol.MCSe return pack, nil } -func SendToGate(sid int64, packetid int, rawpack interface{}, s *netlib.Session) bool { - if s == nil || rawpack == nil || sid == 0 { +func SendToGate(sid int64, packetId int, pack interface{}, s *netlib.Session) bool { + if s == nil || pack == nil || sid == 0 { return false } - pack, err := createMulticastPacket(packetid, rawpack, + pack, err := createMulticastPacket(packetId, pack, &protocol.MCSessionUnion{ Mccs: &protocol.MCClientSession{ SId: proto.Int64(sid)}}) @@ -63,25 +62,17 @@ func SendToGate(sid int64, packetid int, rawpack interface{}, s *netlib.Session) return false } -func SendToActThrSrv(packetid int, rawpack interface{}) bool { - if rawpack == nil { - return false - } - - replaySess := srvlib.ServerSessionMgrSington.GetSession(GetSelfAreaId(), ActThrServerType, ActThrServerID) - if replaySess != nil { - return replaySess.Send(int(packetid), rawpack) - } - return false -} - -func TransmitToServer(sid int64, packetid int, rawpack interface{}, s *netlib.Session) bool { - if d, err := netlib.MarshalPacket(packetid, rawpack); err == nil { +// TransmitToServer 转发消息到指定服务器 +// sid: 客户端连接标识 +// packetId: 消息id +// pack: 消息内容 +// s: 接收消息的服务器连接 +func TransmitToServer(sid int64, packetId int, pack interface{}, s *netlib.Session) bool { + if d, err := netlib.MarshalPacket(packetId, pack); err == nil { pack := &protocol_game.SSTransmit{ PacketData: d, SessionId: sid, } - proto.SetDefaults(pack) return s.Send(int(protocol_game.TransmitPacketID_PACKET_SS_PACKET_TRANSMIT), pack, true) } else { logger.Logger.Warn("TransmitToServer err:", err) diff --git a/gamesrv/tienlen/scenedata_tienlen.go b/gamesrv/tienlen/scenedata_tienlen.go index ef51f19..89d13c7 100644 --- a/gamesrv/tienlen/scenedata_tienlen.go +++ b/gamesrv/tienlen/scenedata_tienlen.go @@ -1968,7 +1968,7 @@ func (this *TienLenSceneData) TrySmallGameBilled() { score = losePlayerCoin } //判断宠物技能生不生效 - if losePlayer.PetUseSkill() { + if losePlayer.PetUseSkill() && !this.IsCustom() && !this.IsMatchScene() { score = 0 //通知客户端宠物技能生效 炸弹不扣分 pack := &tienlen.SCTienLenPetSkillRes{} diff --git a/worldsrv/player.go b/worldsrv/player.go index 307b643..fba1f6c 100644 --- a/worldsrv/player.go +++ b/worldsrv/player.go @@ -3161,25 +3161,6 @@ func (this *Player) AddCoinPayTotal(coin int64) { this.CoinPayTotal += coin } -// 当用户充值 -func OnPlayerPay(pd *model.PlayerData, coin int64) { - if pd == nil { - return - } - - buf, err := pd.GetPlayerDataEncoder() - if err == nil { - pack := &serverproto.WTPlayerPay{ - AddCoin: proto.Int64(coin), - PlayerData: buf.Bytes(), - } - proto.SetDefaults(pack) - common.SendToActThrSrv(int(serverproto.SSPacketID_PACKET_WT_PLAYERPAY), pack) - } - - //ActFPayMgrSington.OnPlayerPay(pd.SnId, pd.Platform, coin) -} - func (this *Player) SendPlatformCanUsePromoterBind() { state := int32(0) plt := PlatformMgrSingleton.GetPlatform(this.Platform)