From ac0e60d82a41d51ce63323389b2224ef2200f2dd Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 09 十月 2020 18:14:16 +0800
Subject: [PATCH] 8542 【主干】【长尾】【BT】【后端】组队逻辑优化(支持发送teamID请求加入;支持双方无队伍请求加入,被请求玩家为队长)
---
ServerPython/CoreServerGroup/GameServer/PyNetPack.ini | 6 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py | 52 +++++++++++++++++
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerTeam.py | 42 ++++++++++++-
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py | 52 +++++++++++++++++
4 files changed, 147 insertions(+), 5 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/PyNetPack.ini b/ServerPython/CoreServerGroup/GameServer/PyNetPack.ini
index 06be58e..2681efc 100644
--- a/ServerPython/CoreServerGroup/GameServer/PyNetPack.ini
+++ b/ServerPython/CoreServerGroup/GameServer/PyNetPack.ini
@@ -254,7 +254,7 @@
Writer = hxp
Releaser = hxp
RegType = 0
-RegisterPackCount = 10
+RegisterPackCount = 11
PacketCMD_1=0xB9
PacketSubCMD_1=0x01
@@ -296,6 +296,10 @@
PacketSubCMD_10=0x0A
PacketCallFunc_10=OnInvitePlayerJoinTeamByLV
+PacketCMD_11=0xB9
+PacketSubCMD_11=0x11
+PacketCallFunc_11=OnRequestJoinTeam
+
[PlayerViewCache]
ScriptName = Player\PlayerViewCache.py
Writer = alee
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
index 7b71519..87db781 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -3567,6 +3567,58 @@
#------------------------------------------------------
+# B9 11 请求加入队伍 #tagCGRequestJoinTeam
+
+class tagCGRequestJoinTeam(Structure):
+ _pack_ = 1
+ _fields_ = [
+ ("Cmd", c_ubyte),
+ ("SubCmd", c_ubyte),
+ ("TeamID", c_int), # 目标队伍ID
+ ]
+
+ def __init__(self):
+ self.Clear()
+ self.Cmd = 0xB9
+ self.SubCmd = 0x11
+ return
+
+ def ReadData(self, stringData, _pos=0, _len=0):
+ self.Clear()
+ memmove(addressof(self), stringData[_pos:], self.GetLength())
+ return _pos + self.GetLength()
+
+ def Clear(self):
+ self.Cmd = 0xB9
+ self.SubCmd = 0x11
+ self.TeamID = 0
+ return
+
+ def GetLength(self):
+ return sizeof(tagCGRequestJoinTeam)
+
+ def GetBuffer(self):
+ return string_at(addressof(self), self.GetLength())
+
+ def OutputString(self):
+ DumpString = '''// B9 11 请求加入队伍 //tagCGRequestJoinTeam:
+ Cmd:%s,
+ SubCmd:%s,
+ TeamID:%d
+ '''\
+ %(
+ self.Cmd,
+ self.SubCmd,
+ self.TeamID
+ )
+ return DumpString
+
+
+m_NAtagCGRequestJoinTeam=tagCGRequestJoinTeam()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCGRequestJoinTeam.Cmd,m_NAtagCGRequestJoinTeam.SubCmd))] = m_NAtagCGRequestJoinTeam
+
+
+#------------------------------------------------------
# B9 09 队员进入副本准备选择 #tagCGTeamMemberPrepare
class tagCGTeamMemberPrepare(Structure):
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerTeam.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerTeam.py
index 800392f..920283b 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerTeam.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerTeam.py
@@ -361,6 +361,24 @@
return
+#// B9 11 请求加入队伍 #tagCGRequestJoinTeam
+#
+#struct tagCGRequestJoinTeam
+#{
+# tagHead Head;
+# DWORD TeamID; // 目标队伍ID
+#};
+def OnRequestJoinTeam(index, clientData, tick):
+ curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+ teamID = clientData.TeamID
+ tagPlayerTeam = GameWorld.GetTeamManager().FindTeam(teamID)
+ if tagPlayerTeam == None:
+ # TeamNoExist 队伍不存在
+ PlayerControl.NotifyCode(curPlayer, "TeamNoExist")
+ return
+ RequestJoinTeamReq(curPlayer, tagPlayerTeam, tick)
+ return
+
#//09 09 请求加入队伍#tagCRequestJoinTeam
#
#struct tagCRequestJoinTeam
@@ -401,9 +419,23 @@
if tagPlayerTeam == None:
# TeamNoExist 队伍不存在
- PlayerControl.NotifyCode(curPlayer, "TeamNoExist")
+ #PlayerControl.NotifyCode(curPlayer, "TeamNoExist")
#目标玩家没有队伍, 邀请玩家加入, 支持无队伍双方无队伍邀请
#InvitePlayerJoinTeamReq(curPlayer, tagPlayer, curPlayerTeam, tick)
+
+ #支持双方无队伍请求加入,直接发送给被请求方确认
+ #通知客户端弹窗口(目标弹框)
+ requestPack = ChPyNetSendPack.tagGCRequestJoinTeam()
+ requestPack.PlayerID = playerID
+ requestPack.Name = curPlayer.GetName()
+ requestPack.NameLen = len(requestPack.Name)
+ requestPack.LV = curPlayer.GetLV()
+ requestPack.Job = curPlayer.GetJob()
+ requestPack.RealmLV = curPlayer.GetOfficialRank()
+ NetPackCommon.SendFakePack(tagPlayer, requestPack)
+
+ #TeamAskSuccess: 已成功发送入队申请
+ PlayerControl.NotifyCode(curPlayer, "TeamAskSuccess")
else:
# 请求加入队伍(#被请求的玩家有队,请求加入其队伍)
RequestJoinTeamReq(curPlayer, tagPlayerTeam, tick)
@@ -752,9 +784,11 @@
#被邀请的玩家队伍
curPlayerTeam = curPlayer.GetTeam()
if curPlayerTeam == None:
- GameWorld.DebugLog("玩家无队伍,无法审核加入队伍请求!" , playerID)
- PlayerControl.NotifyCode(tagPlayer, "TeamNoExist")
- return
+ pass
+ #屏蔽,修改为支持无队伍被请求加入
+ #GameWorld.DebugLog("玩家无队伍,无法审核加入队伍请求!" , playerID)
+ #PlayerControl.NotifyCode(tagPlayer, "TeamNoExist")
+ #return
#申请入队的允许双方都有队伍
# #发出申请的玩家的队伍
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
index 7b71519..87db781 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -3567,6 +3567,58 @@
#------------------------------------------------------
+# B9 11 请求加入队伍 #tagCGRequestJoinTeam
+
+class tagCGRequestJoinTeam(Structure):
+ _pack_ = 1
+ _fields_ = [
+ ("Cmd", c_ubyte),
+ ("SubCmd", c_ubyte),
+ ("TeamID", c_int), # 目标队伍ID
+ ]
+
+ def __init__(self):
+ self.Clear()
+ self.Cmd = 0xB9
+ self.SubCmd = 0x11
+ return
+
+ def ReadData(self, stringData, _pos=0, _len=0):
+ self.Clear()
+ memmove(addressof(self), stringData[_pos:], self.GetLength())
+ return _pos + self.GetLength()
+
+ def Clear(self):
+ self.Cmd = 0xB9
+ self.SubCmd = 0x11
+ self.TeamID = 0
+ return
+
+ def GetLength(self):
+ return sizeof(tagCGRequestJoinTeam)
+
+ def GetBuffer(self):
+ return string_at(addressof(self), self.GetLength())
+
+ def OutputString(self):
+ DumpString = '''// B9 11 请求加入队伍 //tagCGRequestJoinTeam:
+ Cmd:%s,
+ SubCmd:%s,
+ TeamID:%d
+ '''\
+ %(
+ self.Cmd,
+ self.SubCmd,
+ self.TeamID
+ )
+ return DumpString
+
+
+m_NAtagCGRequestJoinTeam=tagCGRequestJoinTeam()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCGRequestJoinTeam.Cmd,m_NAtagCGRequestJoinTeam.SubCmd))] = m_NAtagCGRequestJoinTeam
+
+
+#------------------------------------------------------
# B9 09 队员进入副本准备选择 #tagCGTeamMemberPrepare
class tagCGTeamMemberPrepare(Structure):
--
Gitblit v1.8.0