5424 【后端】【1.4】跨服竞技场开发(增加强制退出跨服状态;增加相关提示;增加部分匹配限制;组队匹配进入副本增加验证是否跨服匹配中)
| | |
| | | Writer = hxp
|
| | | Releaser = hxp
|
| | | RegType = 0
|
| | | RegisterPackCount = 1
|
| | | RegisterPackCount = 2
|
| | |
|
| | | PacketCMD_1=0xC0
|
| | | PacketSubCMD_1=0x02
|
| | | PacketCallFunc_1=OnViewCrossPlayerInfo
|
| | |
|
| | | PacketCMD_2=0xC0
|
| | | PacketSubCMD_2=0x03
|
| | | PacketCallFunc_2=OnForceQuitCrossState
|
| | |
|
| | | [PlayerXMZZ]
|
| | | ScriptName = Player\PlayerXMZZ.py
|
| | | Writer = xdh
|
| | |
| | | Def_PlayerKey_MergeRegisterType = "MergeRegisterType" #当前上传数据的活动类型
|
| | | Def_PlayerKey_MergeRegisterRoomID = "MergeRegisterRoomID" #当前上传数据的roomID
|
| | | Def_PlayerKey_IsLoginToMergeServer = "IsLoginToMergeServer" #是否要登陆跨服服务器
|
| | | Def_PlayerKey_IsCrossPKMatching = "IsCrossPKMatching" #是否跨服匹配中
|
| | |
|
| | | Def_PlayerKey_FreshmanGuiderDay = "FreshmanGuiderDay" #新手指导员天数
|
| | |
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # C0 03 强制退出跨服状态 #tagCGForceQuitCrossState
|
| | |
|
| | | class tagCGForceQuitCrossState(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xC0
|
| | | self.SubCmd = 0x03
|
| | | 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 = 0xC0
|
| | | self.SubCmd = 0x03
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCGForceQuitCrossState)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// C0 03 强制退出跨服状态 //tagCGForceQuitCrossState:
|
| | | Cmd:%s,
|
| | | SubCmd:%s
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCGForceQuitCrossState=tagCGForceQuitCrossState()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCGForceQuitCrossState.Cmd,m_NAtagCGForceQuitCrossState.SubCmd))] = m_NAtagCGForceQuitCrossState
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # C0 01 查看跨服竞技场赛季排行榜 #tagCGViewCrossPKBillboard
|
| | |
|
| | | class tagCGViewCrossPKBillboard(Structure):
|
| | |
| | | }
|
| | | CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_PKCancel, dataMsg)
|
| | | PlayerControl.SetVsRoomId(curPlayer, 0)
|
| | | SetIsCrossPKMatching(curPlayer, 0)
|
| | | GameWorld.Log("发送取消跨服PK匹配到跨服服务器:dataMsg=%s" % str(dataMsg), curPlayer.GetPlayerID())
|
| | | return
|
| | |
|
| | |
| | | return
|
| | |
|
| | | if result == 1:
|
| | | SetIsCrossPKMatching(curPlayer, 1)
|
| | | NetPackCommon.SendFakePack(curPlayer, ChPyNetSendPack.tagGCCrossRealmPKStartMatch())
|
| | |
|
| | | return
|
| | |
|
| | | ## 跨服匹配状态
|
| | | def SetIsCrossPKMatching(curPlayer, isMatching):
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_IsCrossPKMatching, isMatching)
|
| | | sysMsg = str(isMatching)
|
| | | curPlayer.MapServer_QueryPlayerResult(0, 0, "CrossPKMatching", sysMsg, len(sysMsg))
|
| | | return
|
| | | def GetIsCrossPKMatching(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_IsCrossPKMatching)
|
| | |
|
| | | def CrossServerMsg_PKMatchResult(vsRoomDict):
|
| | | ## 跨服PK匹配结果
|
| | |
| | | break
|
| | |
|
| | | PlayerControl.SetCrossRealmState(player, 1)
|
| | | SetIsCrossPKMatching(player, 0)
|
| | |
|
| | | # 通知匹配成功,可进入跨服
|
| | | matchOKPack = ChPyNetSendPack.tagGCCrossRealmPKMatchOK()
|
| | |
| | | # 通用包,通知客户端可进入跨服服务器
|
| | | return
|
| | |
|
| | | #// C0 03 强制退出跨服状态 #tagCGForceQuitCrossState
|
| | | #
|
| | | #struct tagCGForceQuitCrossState
|
| | | #{
|
| | | # tagHead Head;
|
| | | #};
|
| | | def OnForceQuitCrossState(index, clientData, tick):
|
| | | ''' 约定该封包仅玩家当前处于跨服状态,但是一直连不上跨服服务器时才会发次包强制重置跨服状态
|
| | | 一般是跨服服务器异常或其他错误导致无法登录跨服服务器
|
| | | '''
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | GameWorld.ErrLog("某些异常情况下,前端强制发包退出跨服状态! ", curPlayer.GetPlayerID())
|
| | | PlayerControl.SetCrossRealmState(curPlayer, 0)
|
| | | return
|
| | |
|
| | | #// C0 02 查看跨服玩家信息 #tagCGViewCrossPlayerInfo
|
| | | #
|
| | | #struct tagCGViewCrossPlayerInfo
|
| | |
| | | ["TeamEnterDefaultMe", "TeamEnterDefaultAll"], "SingleEnterDefaul"],
|
| | | ShareDefine.EntFBAskRet_Sit:[["TeamMatchingSITMe", "TeamMatchingSITAll"],
|
| | | ["TeamEnterSITMe", "TeamEnterSITAll"], "Carry_lhs_697674"],
|
| | | ShareDefine.EntFBAskRet_CrossPKMatching:[["CrossMatching9", "CrossMatching10"], |
| | | ["CrossMatching11", "CrossMatching12"], "CrossMatching8"],
|
| | | ShareDefine.EntFBAskRet_Other:[["TeamMatchingDefaultMe", "TeamMatchingDefaultAll"],
|
| | | ["TeamEnterDefaultMe", "TeamEnterDefaultAll"], "SingleEnterDefaul"],
|
| | | }
|
| | |
| | | EntFBAskRet_InFB, # 11 副本中
|
| | | EntFBAskRet_TJG, # 12 脱机挂中
|
| | | EntFBAskRet_Sit, # 13 打坐中
|
| | | EntFBAskRet_CrossPKMatching,# 14 跨服匹配中
|
| | | EntFBAskRet_Other, # xx 其他限制
|
| | | EntFBAskRet_Max,
|
| | | ) = range(16)
|
| | | ) = range(17)
|
| | |
|
| | |
|
| | | #增加仙盟活跃的活动类型
|
| | |
| | | Def_PlayerKey_CalcAddAttrType = "CalcAType_%s_%s_%s" # 刷属性类型, 参数[funcIndex, attrIndex, 缓存编号]
|
| | | Def_PlayerKey_CalcAddAttrValue = "CalcAValue_%s_%s_%s" # 刷属性值, 参数[funcIndex, attrIndex, 缓存编号]
|
| | |
|
| | | Def_PlayerKey_IsCrossPKMatching = "IsCrossPKMatching" #是否跨服匹配中
|
| | |
|
| | | Def_PDict_QueryTechLVUPState = "QueryTechLVUPState" # 查询科技等级提升状态
|
| | |
|
| | | Def_PDict_PKStateTick = "PKStateTick" # PK状态tick,只要有一方发起攻击,双方均进入PK状态
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # C0 03 强制退出跨服状态 #tagCGForceQuitCrossState
|
| | |
|
| | | class tagCGForceQuitCrossState(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xC0
|
| | | self.SubCmd = 0x03
|
| | | 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 = 0xC0
|
| | | self.SubCmd = 0x03
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCGForceQuitCrossState)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// C0 03 强制退出跨服状态 //tagCGForceQuitCrossState:
|
| | | Cmd:%s,
|
| | | SubCmd:%s
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCGForceQuitCrossState=tagCGForceQuitCrossState()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCGForceQuitCrossState.Cmd,m_NAtagCGForceQuitCrossState.SubCmd))] = m_NAtagCGForceQuitCrossState
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # C0 01 查看跨服竞技场赛季排行榜 #tagCGViewCrossPKBillboard
|
| | |
|
| | | class tagCGViewCrossPKBillboard(Structure):
|
| | |
| | | def DoEnterCrossRealm(curPlayer):
|
| | | ## 玩家进入跨服处理,本服的逻辑处理
|
| | | curPlayer.SetVisible(False)
|
| | | curPet = curPlayer.GetPetMgr().GetFightPet()
|
| | | if curPet:
|
| | | curPet.SetVisible(False)
|
| | | return
|
| | |
|
| | | def DoExitCrossRealm(curPlayer):
|
| | | ## 玩家退出跨服处理,本服的逻辑处理
|
| | | GameWorld.Log("DoExitCrossRealm...", curPlayer.GetPlayerID())
|
| | | curPlayer.SetVisible(True)
|
| | | curPet = curPlayer.GetPetMgr().GetFightPet()
|
| | | if curPet:
|
| | | curPet.SetVisible(True)
|
| | | if PlayerControl.GetCrossRealmState(curPlayer):
|
| | | PlayerControl.SetCrossRealmState(curPlayer, 0)
|
| | | |
| | | return
|
| | |
| | | import PlayerFamilyTech
|
| | | import PlayerCostRebate
|
| | | import PlayerFairyCeremony
|
| | | import PlayerCrossRealmPK
|
| | | import FunctionNPCCommon
|
| | | import CrossRealmPlayer
|
| | | import ChNetSendPack
|
| | |
| | | NotifyCode(curPlayer, "SingleEnterPK", [mapID])
|
| | | return ShareDefine.EntFBAskRet_PKState
|
| | |
|
| | | ## 跨服PK匹配中
|
| | | if PlayerCrossRealmPK.GetIsCrossPKMatching(curPlayer):
|
| | | if isNotify:
|
| | | NotifyCode(curPlayer, "CrossMatching8", [mapID]) |
| | | return ShareDefine.EntFBAskRet_CrossPKMatching
|
| | | |
| | | #===============================================================================================
|
| | | # # 这里不做状态限制,由前端处理,因为策划要根据界面来处理,同一传送功能有可能在不同界面
|
| | | # # PK状态检查
|
| | |
| | | import GameWorld
|
| | | import ChConfig
|
| | |
|
| | | ## 是否匹配中
|
| | | def SetIsCrossPKMatching(curPlayer, isMatching):
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_IsCrossPKMatching, isMatching)
|
| | | return
|
| | | def GetIsCrossPKMatching(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_IsCrossPKMatching)
|
| | |
|
| | | def DoPlayerOnDay(curPlayer):
|
| | | if GameWorld.IsCrossServer():
|
| | | return
|
| | |
| | | requestType = clientData.Type
|
| | |
|
| | | if GameWorld.IsCrossServer():
|
| | | GameWorld.DebugLog("跨服服务器无法发起匹配!")
|
| | | GameWorld.DebugLog("跨服服务器无法发起匹配!", playerID)
|
| | | return
|
| | | |
| | | if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull:
|
| | | GameWorld.DebugLog("副本中,无法进行跨服匹配!", playerID)
|
| | | return
|
| | | |
| | | if curPlayer.GetPlayerAction() == IPY_GameWorld.paDie or curPlayer.GetHP() == 0:
|
| | | #GameWorld.DebugLog("已死亡,无法进行跨服匹配!", playerID)
|
| | | return
|
| | |
|
| | | if GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKSeasonState) != 1:
|
| | | GameWorld.DebugLog("OnCrossRealmPKMatch 跨服赛季未开启,不可进行匹配!", playerID)
|
| | | PlayerControl.NotifyCode(curPlayer, "SeasonIsNotOpen")
|
| | | #PlayerControl.NotifyCode(curPlayer, "SeasonIsNotOpen")
|
| | | return
|
| | |
|
| | | if not IsCrossRealmPKMatchState():
|
| | | GameWorld.DebugLog("OnCrossRealmPKMatch 跨服匹配未开启,不可进行匹配!", playerID)
|
| | | PlayerControl.NotifyCode(curPlayer, "MatchIsNotOpen")
|
| | | #PlayerControl.NotifyCode(curPlayer, "MatchIsNotOpen")
|
| | | return
|
| | |
|
| | | GameWorld.Log("收到跨服PK匹配: type=%s,accID=%s" % (requestType, accID), playerID)
|
| | |
| | |
|
| | | # 取消匹配
|
| | | else:
|
| | | sendMsg = "Client Cancel!"
|
| | | sendMsg = "ClientCancel"
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(playerID, 0, 0, "CrossRealmPKCancel", sendMsg, len(sendMsg))
|
| | | GameWorld.Log(" 发送取消匹配到GameServer sendMsg=%s" % str(sendMsg), playerID)
|
| | |
|
New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package Player.RemoteQuery.GY_Query_CrossPKMatching
|
| | | #
|
| | | # @todo:是否跨服匹配状态更新
|
| | | # @author hxp
|
| | | # @date 2018-12-26
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 是否跨服匹配状态更新
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2018-12-26 18:30"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import PlayerCrossRealmPK
|
| | | import GameWorld
|
| | |
|
| | | #------------------------------------------------------------------------------ |
| | | ## 跨服赛报名调用接口
|
| | | # @param query_Type 请求类型
|
| | | # @param query_ID 请求的玩家ID
|
| | | # @param packCMDList 发包命令
|
| | | # @param tick 当前时间
|
| | | # @return "True" or "False" or ""
|
| | | # @remarks 函数详细说明.
|
| | | def DoLogic(query_Type, query_ID, packCMDList, tick): |
| | | return
|
| | |
|
| | |
|
| | | #------------------------------------------------------------------------------ |
| | | ## 执行结果
|
| | | # @param curPlayer 发出请求的玩家
|
| | | # @param callFunName 功能名称
|
| | | # @param funResult 查询的结果
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def DoResult(curPlayer, callFunName, funResult, tick):
|
| | | isMatching = eval(funResult)
|
| | | GameWorld.Log("GY_Query_CrossPKMatching isMatching=%s" % isMatching, curPlayer.GetPlayerID())
|
| | | if not curPlayer:
|
| | | return
|
| | | PlayerCrossRealmPK.SetIsCrossPKMatching(curPlayer, isMatching)
|
| | | return
|
| | |
|
| | | |
| | | |
| | |
| | | EntFBAskRet_InFB, # 11 副本中
|
| | | EntFBAskRet_TJG, # 12 脱机挂中
|
| | | EntFBAskRet_Sit, # 13 打坐中
|
| | | EntFBAskRet_CrossPKMatching,# 14 跨服匹配中
|
| | | EntFBAskRet_Other, # xx 其他限制
|
| | | EntFBAskRet_Max,
|
| | | ) = range(16)
|
| | | ) = range(17)
|
| | |
|
| | |
|
| | | #增加仙盟活跃的活动类型
|