|  |  | 
 |  |  | #"""Version = 2015-07-17 13:50"""
 | 
 |  |  | #---------------------------------------------------------------------
 | 
 |  |  | 
 | 
 |  |  | import PlayerAssist
 | 
 |  |  | #import PlayerRequest
 | 
 |  |  | import GameWorldBoss
 | 
 |  |  | import IpyGameDataPY
 | 
 |  |  | 
 |  |  | import IPY_GameServer
 | 
 |  |  | import ChGameToMapPyPack
 | 
 |  |  | import ChPyNetSendPack
 | 
 |  |  | import DataRecordPack
 | 
 |  |  | import PlayerControl
 | 
 |  |  | import PlayerFriend
 | 
 |  |  | import ShareDefine
 | 
 |  |  | import PyGameData
 | 
 |  |  | import GameWorld
 | 
 |  |  | 
 |  |  |     #设置当前玩家为队长
 | 
 |  |  |     curNewTeamMenber = curNewTeam.GetMemberByID(curPlayerID)
 | 
 |  |  |     if curNewTeamMenber == None:
 | 
 |  |  |         GameWorld.ErrLog("设置当前创建队伍玩家为队长, 找不到玩家!", curPlayerID)
 | 
 |  |  |         GameWorld.ErrLog("设置当前创建队伍玩家为队长, 找不到玩家!teamID=%s" % teamID, curPlayerID)
 | 
 |  |  |         DR_Team("CreateError", teamID, {"Leader":curPlayerID, "tagMapID":tagMapID, "tagMapEx":tagMapEx, "reqMinLV":reqMinLV, "reqMaxLV":reqMaxLV})
 | 
 |  |  |         return
 | 
 |  |  |     
 | 
 |  |  |     __SetTeamLV(curNewTeamMenber, IPY_GameServer.tmlLeader, False)
 | 
 |  |  |     if isSync:
 | 
 |  |  |         Sync_TeamMemberInfo(curNewTeam)
 | 
 |  |  |         SyncMapServerTeamInfo(curNewTeam)
 | 
 |  |  |         SyncMapServerTeamInfo(curNewTeam, "Create", {"Leader":curPlayerID, "tagMapID":tagMapID, "tagMapEx":tagMapEx, "reqMinLV":reqMinLV, "reqMaxLV":reqMaxLV})
 | 
 |  |  |         
 | 
 |  |  |     DelPlayerIDFromMatchingList(curPlayer)
 | 
 |  |  |     return curNewTeam
 | 
 |  |  | 
 |  |  |     
 | 
 |  |  |     #邀请组队的时候,双方都有队伍不处理
 | 
 |  |  |     if curPlayerTeam != None and tagPlayerTeam != None:
 | 
 |  |  |         #InviteEnterLost02  <n color="255,255,0">`o很抱歉,目标玩家已在他人队伍中,邀请入队失败!</n>  25  -   -
 | 
 |  |  |         #PlayerControl.NotifyCode(curPlayer, "InviteEnterLost02")
 | 
 |  |  |         InvitePlayerJoinTeamReq(curPlayer, tagPlayer, curPlayerTeam, tick)
 | 
 |  |  |         #该玩家已在他人队伍中,邀请入队失败!
 | 
 |  |  |         PlayerControl.NotifyCode(curPlayer, "InviteEnterLost02")
 | 
 |  |  |         #InvitePlayerJoinTeamReq(curPlayer, tagPlayer, curPlayerTeam, tick)
 | 
 |  |  |         return
 | 
 |  |  |     
 | 
 |  |  |     if tagPlayerTeam == None:
 | 
 |  |  | 
 |  |  |     else:
 | 
 |  |  |         GameWorld.Log("OnInvitePlayerJoinTeam ->组队系统异常" , curPlayer.GetPlayerID())
 | 
 |  |  |         
 | 
 |  |  |     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
 | 
 |  |  | 
 |  |  |         return
 | 
 |  |  |     
 | 
 |  |  |     #获得双方的队伍
 | 
 |  |  |     #curPlayerTeam = curPlayer.GetTeam()
 | 
 |  |  |     curPlayerTeam = curPlayer.GetTeam()
 | 
 |  |  |     tagPlayerTeam = tagPlayer.GetTeam()
 | 
 |  |  |         
 | 
 |  |  |     #请求加入的时候,双方都有队伍也可请求加入,支持退出队伍请求加入
 | 
 |  |  | #    if curPlayerTeam != None and tagPlayerTeam != None:
 | 
 |  |  | #        #InviteEnterLost02  <n color="255,255,0">`o很抱歉,目标玩家已在他人队伍中,邀请入队失败!</n>  25  -   -
 | 
 |  |  | #        PlayerControl.NotifyCode(curPlayer, "InviteEnterLost02")
 | 
 |  |  | #        return
 | 
 |  |  |     if curPlayerTeam != None and tagPlayerTeam != None:
 | 
 |  |  |         #您已有队伍,请先退出再申请
 | 
 |  |  |         PlayerControl.NotifyCode(curPlayer, "Friend_HaveTeam")
 | 
 |  |  |         return
 | 
 |  |  | 
 | 
 |  |  |     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)
 | 
 |  |  | 
 |  |  |     invitePack.NameLen = len(invitePack.Name)
 | 
 |  |  |     invitePack.LV = curPlayer.GetLV()
 | 
 |  |  |     invitePack.Job = curPlayer.GetJob()
 | 
 |  |  |     invitePack.JobLevel = PlayerControl.GetJobRank(curPlayer)
 | 
 |  |  |     invitePack.RealmLV = curPlayer.GetOfficialRank()
 | 
 |  |  |     invitePack.TagMapID = tagMapID
 | 
 |  |  |     invitePack.TagMapEx = tagMapEx
 | 
 |  |  | 
 |  |  |     requestPack.NameLen = len(requestPack.Name)
 | 
 |  |  |     requestPack.LV = curPlayer.GetLV()
 | 
 |  |  |     requestPack.Job = curPlayer.GetJob()
 | 
 |  |  |     requestPack.JobLevel = PlayerControl.GetJobRank(curPlayer)
 | 
 |  |  |     requestPack.RealmLV = curPlayer.GetOfficialRank()
 | 
 |  |  |     NetPackCommon.SendFakePack(tagPlayer, requestPack)
 | 
 |  |  |     
 | 
 |  |  | 
 |  |  |         PlayerControl.NotifyCode(curPlayer, "TeamEnterForbid")
 | 
 |  |  |         return False
 | 
 |  |  |     
 | 
 |  |  |     if PlayerControl.GetAssistTagPlayerID(curPlayer):
 | 
 |  |  |         #协助中无法执行此操作
 | 
 |  |  |         PlayerControl.NotifyCode(curPlayer, "InAssistForbid")
 | 
 |  |  |         return False
 | 
 |  |  |      | 
 |  |  |     if tagPlayer:
 | 
 |  |  |         tagPlayerID = tagPlayer.GetPlayerID()
 | 
 |  |  |         #检查ID
 | 
 |  |  | 
 |  |  |             return False
 | 
 |  |  |         if IsInEnterFBTeamPrepare(tagTeamID):
 | 
 |  |  |             PlayerControl.NotifyCode(curPlayer, "TeamEnterForbid")
 | 
 |  |  |             return False
 | 
 |  |  |          | 
 |  |  |         if PlayerControl.GetAssistTagPlayerID(tagPlayer):
 | 
 |  |  |             #对方协助中,无法执行此操作
 | 
 |  |  |             PlayerControl.NotifyCode(curPlayer, "TagInAssistForbid")
 | 
 |  |  |             return False
 | 
 |  |  |         
 | 
 |  |  |     return True
 | 
 |  |  | 
 |  |  |         return
 | 
 |  |  |     
 | 
 |  |  |     #双方的队伍
 | 
 |  |  |     #curPlayerTeam = curPlayer.GetTeam()  | 
 |  |  |     curPlayerTeam = curPlayer.GetTeam()  | 
 |  |  |     tagPlayerTeam = tagPlayer.GetTeam()
 | 
 |  |  |     
 | 
 |  |  |     if tagPlayerTeam == None:
 | 
 |  |  | 
 |  |  |         PlayerControl.NotifyCode(curPlayer, "TeamNoExist")
 | 
 |  |  |         return
 | 
 |  |  |     
 | 
 |  |  |     #===============================================================================================
 | 
 |  |  |     # if curPlayerTeam != None:
 | 
 |  |  |     #    #InviteEnterLost02  组队失败,双方都有队伍!
 | 
 |  |  |     #    PlayerControl.NotifyCode(curPlayer, "InviteEnterLost02")
 | 
 |  |  |     #    return
 | 
 |  |  |     #===============================================================================================
 | 
 |  |  |     if curPlayerTeam != None:
 | 
 |  |  |         #您已有队伍,请先退出再申请
 | 
 |  |  |         PlayerControl.NotifyCode(curPlayer, "Friend_HaveTeam")
 | 
 |  |  |         return
 | 
 |  |  |     
 | 
 |  |  |     #组队类型
 | 
 |  |  |     #teamType = sendPack.GetTeamType()
 | 
 |  |  | 
 |  |  |     #被邀请的玩家队伍
 | 
 |  |  |     curPlayerTeam = curPlayer.GetTeam()
 | 
 |  |  |     if curPlayerTeam == None:
 | 
 |  |  |         GameWorld.DebugLog("玩家无队伍,无法审核加入队伍请求!" , playerID)
 | 
 |  |  |         PlayerControl.NotifyCode(tagPlayer, "TeamNoExist")
 | 
 |  |  |         return
 | 
 |  |  |         pass
 | 
 |  |  |         #屏蔽,修改为支持无队伍被请求加入
 | 
 |  |  |         #GameWorld.DebugLog("玩家无队伍,无法审核加入队伍请求!" , playerID)
 | 
 |  |  |         #PlayerControl.NotifyCode(tagPlayer, "TeamNoExist")
 | 
 |  |  |         #return
 | 
 |  |  |     
 | 
 |  |  |     #申请入队的允许双方都有队伍
 | 
 |  |  | #    #发出申请的玩家的队伍
 | 
 |  |  | #    tagPlayerTeam = tagPlayer.GetTeam()
 | 
 |  |  | #    if tagPlayerTeam != None:
 | 
 |  |  | #        #InviteEnterLost02  组队失败,双方都有队伍!
 | 
 |  |  | #        PlayerControl.NotifyCode(tagPlayer, "InviteEnterLost02")
 | 
 |  |  | #        return
 | 
 |  |  |     #发出申请的玩家的队伍
 | 
 |  |  |     tagPlayerTeam = tagPlayer.GetTeam()
 | 
 |  |  |     if tagPlayerTeam != None:
 | 
 |  |  |         #该玩家已有队伍,同意时才提示对方有队伍
 | 
 |  |  |         if isAgree == 1:
 | 
 |  |  |             PlayerControl.NotifyCode(curPlayer, "AcceptTeamLost")
 | 
 |  |  |         return
 | 
 |  |  |     
 | 
 |  |  |     #===============================================================================================
 | 
 |  |  |     # #请求检查,是否有这个请求
 | 
 |  |  | 
 |  |  |     #通知MapServerd队伍变更
 | 
 |  |  |     #teamPlayer.MapServer_Sync_Team(__GetPlayerTeamLV(teamPlayer))
 | 
 |  |  |     #joinPlayer.MapServer_Sync_Team(__GetPlayerTeamLV(joinPlayer))
 | 
 |  |  |     SyncMapServerTeamInfo(tagTeam)
 | 
 |  |  |     SyncMapServerTeamInfo(tagTeam, "Join", {"teamPlayer":teamPlayer.GetPlayerID(), "joinPlayer":joinPlayer.GetPlayerID()})
 | 
 |  |  |     
 | 
 |  |  |     #֪ͨ
 | 
 |  |  |     #EnterProcession    <%S%>加入了队伍!  改为 GeRen_chenxin_543685
 | 
 |  |  | 
 |  |  |     teamMember = curTeam.GetMemberByID(curPlayer.GetPlayerID())
 | 
 |  |  |     return teamMember.GetTeamLV()
 | 
 |  |  | 
 | 
 |  |  | def SyncMapServerTeamInfo(curTeam):
 | 
 |  |  | def SyncMapServerTeamInfo(curTeam, eventName="", drDict={}):
 | 
 |  |  |     '''同步队伍信息到 MapServer 给所有在线队员
 | 
 |  |  |     @note: 需要全队同步的情况:创建队伍、队员加入、退出、上线、下线、切换地图、VIP等级变更、VIP到期时间更新
 | 
 |  |  |     '''
 | 
 |  |  |     if not curTeam:
 | 
 |  |  |         DR_Team("%s_Error" % eventName, 0, drDict)
 | 
 |  |  |         return
 | 
 |  |  |     teamID = curTeam.GetTeamID()
 | 
 |  |  |     syncPlayerList = []
 | 
 |  |  |     memInfoList = []
 | 
 |  |  |     memList = []
 | 
 |  |  |     for index in xrange(curTeam.GetMemberCount()):
 | 
 |  |  |         memPlayer = curTeam.GetMemberPlayer(index)
 | 
 |  |  |         memberInfo = curTeam.GetMemberInfo(index)
 | 
 |  |  |         if not memPlayer or not memberInfo:
 | 
 |  |  |         if not memberInfo:
 | 
 |  |  |             memList.append(["not memberInfo"])
 | 
 |  |  |             continue
 | 
 |  |  |         if not memPlayer:
 | 
 |  |  |             memList.append(["not memPlayer"])
 | 
 |  |  |             continue
 | 
 |  |  |         memPlayerID = memPlayer.GetPlayerID()
 | 
 |  |  |         if not memPlayerID:
 | 
 |  |  |             memList.append(["not memPlayerID"])
 | 
 |  |  |             continue
 | 
 |  |  |         memInfo = ChGameToMapPyPack.tagGMTeamMemInfo()
 | 
 |  |  |         memInfo.PlayerID = memPlayerID
 | 
 |  |  | 
 |  |  |         memInfo.VIPLV = PlayerControl.GetValidVIPLV(memPlayer)
 | 
 |  |  |         memInfoList.append(memInfo)
 | 
 |  |  |         syncPlayerList.append([memPlayer, memberInfo.GetTeamLV()])
 | 
 |  |  |         memList.append([memPlayerID, memPlayer.GetTeamID(), memberInfo.GetTeamLV(), memPlayer.GetMapID(), memPlayer.GetFBID()])
 | 
 |  |  |         
 | 
 |  |  |     for player, teamLV in syncPlayerList:
 | 
 |  |  |         teamInfo = ChGameToMapPyPack.tagGMTeamInfo()
 | 
 |  |  | 
 |  |  |         teamInfo.MemCnt = len(teamInfo.MemInfoList)
 | 
 |  |  |         NetPackCommon.SendPyPackToMapServer(player.GetLineNO(), player.GetRealMapID(), teamInfo)
 | 
 |  |  |         
 | 
 |  |  |     drDict.update({"MemList":memList})
 | 
 |  |  |     DR_Team(eventName, teamID, drDict)
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | def SyncMapServerPlayerNoTeam(curPlayer):
 | 
 |  |  |     ## 同步地图玩家没有队伍,切图时调用
 | 
 |  |  |     teamInfo = ChGameToMapPyPack.tagGMTeamInfo()
 | 
 |  |  |     teamInfo.PlayerID = curPlayer.GetPlayerID()
 | 
 |  |  |     teamInfo.TeamID = 0
 | 
 |  |  |     teamInfo.TeamLV = 0
 | 
 |  |  |     teamInfo.MemInfoList = []
 | 
 |  |  |     teamInfo.MemCnt = len(teamInfo.MemInfoList)
 | 
 |  |  |     NetPackCommon.SendPyPackToMapServer(curPlayer.GetLineNO(), curPlayer.GetRealMapID(), teamInfo)
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | def SyncMapServerPlayerLeaveTeam(curPlayer, teamID):
 | 
 |  |  |     ## 同步地图玩家离开队伍
 | 
 |  |  |     leavePack = ChGameToMapPyPack.tagGMPlayerLeaveTeam()
 | 
 |  |  |     leavePack.PlayerID = curPlayer.GetPlayerID()
 | 
 |  |  |     leavePack.CopyMapID = curPlayer.GetFBID()
 | 
 |  |  |     leavePack.TeamID = teamID
 | 
 |  |  |     NetPackCommon.SendPyPackToMapServer(curPlayer.GetLineNO(), curPlayer.GetRealMapID(), leavePack)
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | #---------------------------------------------------------------------
 | 
 |  |  | 
 |  |  |     #通知客户端队伍成员属性变更
 | 
 |  |  |     #curTeam.Sync_TeamState()
 | 
 |  |  |     Sync_TeamMemberInfo(curTeam)
 | 
 |  |  |     SyncMapServerTeamInfo(curTeam)
 | 
 |  |  |     SyncMapServerTeamInfo(curTeam, "ChangeMemTeamLV", {"tagPlayerID":tagPlayerID, "memberLV":memberLV})
 | 
 |  |  |     return
 | 
 |  |  | #---------------------------------------------------------------------
 | 
 |  |  | #===============================================================================
 | 
 |  |  | 
 |  |  |         #GameServer清除玩家队伍ID为空
 | 
 |  |  |         delPlayer.SetTeam(None)
 | 
 |  |  |         #通知MapServerd队伍变更, 在mapserver构建目前队伍
 | 
 |  |  |         delPlayer.MapServer_Sync_Team(0)
 | 
 |  |  |         #delPlayer.MapServer_Sync_Team(0)
 | 
 |  |  |         SyncMapServerPlayerLeaveTeam(delPlayer, curTeam.GetTeamID())
 | 
 |  |  |         #玩家离开副本
 | 
 |  |  |         delPlayer.MapServer_LeaveFB()
 | 
 |  |  |         if IsTeamMatchingPlayer(curTeam.GetTeamID()):
 | 
 |  |  | 
 |  |  |     #广播队伍刷新
 | 
 |  |  |     #curTeam.Sync_TeamState()
 | 
 |  |  |     Sync_TeamMemberInfo(curTeam)
 | 
 |  |  |     SyncMapServerTeamInfo(curTeam)
 | 
 |  |  |     SyncMapServerTeamInfo(curTeam, "Leave", {"delPlayerID":delPlayerID, "msg":msg})
 | 
 |  |  |     
 | 
 |  |  |     #无人在线
 | 
 |  |  |     if curTeam.GetTeamPlayerCount() <= 0:
 | 
 |  |  | 
 |  |  |     '''
 | 
 |  |  |     #GameWorld.DebugLog("玩家队伍变更通用处理,curTeamID=%s" % curPlayer.GetTeamID())
 | 
 |  |  |     GameWorldBoss.OnPlayerTeamChange(curPlayer)
 | 
 |  |  |     PlayerAssist.OnPlayerTeamChange(curPlayer)
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | #---------------------------------------------------------------------
 | 
 |  |  | 
 |  |  |         #GameServer玩家队伍为空
 | 
 |  |  |         curPlayer.SetTeam(None)
 | 
 |  |  |         #通知MapServerd队伍变更
 | 
 |  |  |         curPlayer.MapServer_Sync_Team(0)
 | 
 |  |  |         #curPlayer.MapServer_Sync_Team(0)
 | 
 |  |  |         SyncMapServerPlayerLeaveTeam(curPlayer, curTeam.GetTeamID())
 | 
 |  |  |         __DoLogic_PlayerTeamChange(curPlayer)
 | 
 |  |  | 
 | 
 |  |  |         if curMember.GetTeamLV() != IPY_GameServer.tmlLeader:
 | 
 |  |  | 
 |  |  |     return (teamLV == IPY_GameServer.tmlMemberCanCall or 
 | 
 |  |  |              teamLV == IPY_GameServer.tmlLeader)
 | 
 |  |  |     
 | 
 |  |  | def CheckTeamOnLineCount(curTeam):
 | 
 |  |  | def CheckTeamOnLineCount(curTeam, includeTJG=True):
 | 
 |  |  |     ##获得队伍剩余在线人数
 | 
 |  |  |      | 
 |  |  |     if not curTeam:
 | 
 |  |  |         return 0
 | 
 |  |  |     count = 0
 | 
 |  |  |     for i in xrange(curTeam.GetMemberCount()):
 | 
 |  |  |         curPlayer = curTeam.GetMemberPlayer(i)
 | 
 |  |  |         if curPlayer == None:
 | 
 |  |  |             continue
 | 
 |  |  |         if not includeTJG and PlayerControl.GetIsTJG(curPlayer):
 | 
 |  |  |             continue
 | 
 |  |  |         count += 1
 | 
 |  |  |     return count
 | 
 |  |  | 
 |  |  |         nearbyPlayer.NameLen = len(nearbyPlayer.Name)
 | 
 |  |  |         nearbyPlayer.LV = player.GetLV()
 | 
 |  |  |         nearbyPlayer.Job = player.GetJob()
 | 
 |  |  |         nearbyPlayer.JobLevel = PlayerControl.GetJobRank(player)
 | 
 |  |  |         nearbyPlayer.RealmLV = player.GetOfficialRank()
 | 
 |  |  |         nearbyPlayerInfo.PlayerList.append(nearbyPlayer)
 | 
 |  |  |         
 | 
 |  |  | 
 |  |  |         sceneTeam.NameLen = len(sceneTeam.PlayerName)
 | 
 |  |  |         sceneTeam.LV = leader.GetLV()
 | 
 |  |  |         sceneTeam.Job = leader.GetJob()
 | 
 |  |  |         sceneTeam.JobLevel = PlayerControl.GetJobRank(leader)
 | 
 |  |  |         sceneTeam.RealmLV = leader.GetOfficialRank()
 | 
 |  |  |         sceneTeam.MemberCount = team.GetTeamPlayerCount()
 | 
 |  |  |         sceneTeam.TagMapID = team.GetTagMapID()
 | 
 |  |  | 
 |  |  |             DelTeamIDFromTagMapTeamDict(curTeamID)
 | 
 |  |  |             DelTeamIDFromMatchingList(curTeam)
 | 
 |  |  |                 
 | 
 |  |  |     SyncMapServerTeamInfo(curTeam)
 | 
 |  |  |     SyncMapServerTeamInfo(curTeam, "LogOff", {"playerID":playerID})
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | def OnPlayerLoginRefreshTeam(curPlayer, tick):
 | 
 |  |  | 
 |  |  |         if curTeam == None:
 | 
 |  |  |             return
 | 
 |  |  |         
 | 
 |  |  |         if curTeam.GetTeamPlayerCount() <= 1:
 | 
 |  |  |             #补救完毕, 队伍中只有一个人, 删除这个队伍
 | 
 |  |  |             GameWorld.Log('玩家(%s)仍然有队伍(%s), 补救完毕, 队伍中只有一个人, 删除这个队伍' % (playerID, curTeamID))
 | 
 |  |  |             DeleteTeam(curTeam, tick)
 | 
 |  |  |             return
 | 
 |  |  |         #允许存在单人队伍,暂屏蔽该逻辑
 | 
 |  |  | #        if curTeam.GetTeamPlayerCount() <= 1:
 | 
 |  |  | #            #补救完毕, 队伍中只有一个人, 删除这个队伍
 | 
 |  |  | #            GameWorld.Log('玩家(%s)仍然有队伍(%s), 补救完毕, 队伍中只有一个人, 删除这个队伍' % (playerID, curTeamID))
 | 
 |  |  | #            DeleteTeam(curTeam, tick)
 | 
 |  |  | #            return
 | 
 |  |  | 
 | 
 |  |  |         GameWorld.Log('玩家(%s)仍然有队伍(%s), 补救' % (playerID, curTeamID))
 | 
 |  |  |         curPlayer.SetTeamID(curTeamID)
 | 
 |  |  | 
 |  |  |         curPlayer.SetTeam(None)
 | 
 |  |  |         curPlayer.Sync_LeaveTeam(1)
 | 
 |  |  |         #通知MapServer, 玩家已经队伍了, 刷新玩家的TeamID
 | 
 |  |  |         curPlayer.MapServer_Sync_Team(0)
 | 
 |  |  |         #curPlayer.MapServer_Sync_Team(0)
 | 
 |  |  |         SyncMapServerPlayerLeaveTeam(curPlayer, curTeamID)
 | 
 |  |  |         gameMap = GameWorld.GetMap(curPlayer.GetMapID())
 | 
 |  |  |         if gameMap and gameMap.GetMapFBType() == ChConfig.fbtTeam:
 | 
 |  |  |             curPlayer.MapServer_LeaveFB()
 | 
 |  |  | 
 |  |  |     #通知队伍成员玩家信息
 | 
 |  |  |     #curTeam.Sync_TeamState()
 | 
 |  |  |     Sync_TeamMemberInfo(curTeam)
 | 
 |  |  |     SyncMapServerTeamInfo(curTeam)
 | 
 |  |  |     SyncMapServerTeamInfo(curTeam, "Login", {"playerID":playerID})
 | 
 |  |  |     
 | 
 |  |  |     if not PlayerControl.GetIsTJG(curPlayer):
 | 
 |  |  |         #通知自己队伍玩家上线
 | 
 |  |  | 
 |  |  |     #如果队伍正在匹配中,则通知状态
 | 
 |  |  |     if IsTeamMatchingPlayer(curTeamID):
 | 
 |  |  |         Sync_TeamMatchState(curPlayer, True)
 | 
 |  |  |     OnTeamMemFamilyRefresh(curPlayer, curPlayer.GetFamilyID())
 | 
 |  |  |     return True
 | 
 |  |  | 
 | 
 |  |  | #---------------------------------------------------------------------
 | 
 |  |  | 
 |  |  |     
 | 
 |  |  |     GameWorld.DebugLog("Team.OnPlayerReadMapOK", curPlayer.GetPlayerID())
 | 
 |  |  |     
 | 
 |  |  |     # 登录逻辑已处理,这里不重复处理
 | 
 |  |  |     #===============================================================================================
 | 
 |  |  |     # if curPlayer.GetTeamID() == 0:
 | 
 |  |  |     #    return
 | 
 |  |  |     #     | 
 |  |  |     # curTeam = GameWorld.GetTeamManager().FindTeam(curPlayer.GetTeamID())
 | 
 |  |  |     # if curTeam == None:
 | 
 |  |  |     #    #通知MapServer, 玩家已经队伍了, 刷新玩家的TeamID
 | 
 |  |  |     #    curPlayer.MapServer_Sync_Team(0)
 | 
 |  |  |     #    return
 | 
 |  |  |     #  | 
 |  |  |     # SyncMapServerTeamInfo(curTeam)
 | 
 |  |  |     # #curTeamMember = curTeam.GetMemberByID(curPlayer.GetPlayerID())
 | 
 |  |  |     # ##通知MapServerd队伍变更
 | 
 |  |  |     # #curPlayer.MapServer_Sync_Team(curTeamMember.GetTeamLV())
 | 
 |  |  |     #===============================================================================================
 | 
 |  |  |     if curPlayer.GetTeamID() == 0:
 | 
 |  |  |         return
 | 
 |  |  |      | 
 |  |  |     curTeam = GameWorld.GetTeamManager().FindTeam(curPlayer.GetTeamID())
 | 
 |  |  |     if curTeam == None:
 | 
 |  |  |         #通知MapServer, 玩家已经队伍了, 刷新玩家的TeamID
 | 
 |  |  |         #curPlayer.MapServer_Sync_Team(0)
 | 
 |  |  |         return
 | 
 |  |  |      | 
 |  |  |     mapID = curPlayer.GetMapID()
 | 
 |  |  |     loginMapID = curPlayer.GetDictByKey(ChConfig.Def_PDict_LoginMapID)
 | 
 |  |  |     if loginMapID and mapID != loginMapID:
 | 
 |  |  |         GameWorld.Log("Team.OnPlayerReadMapOK 地图与登录时地图不一致,重新同步一次!loginMapID=%s,mapID=%s"  | 
 |  |  |                       % (loginMapID, mapID), curPlayer.GetPlayerID())
 | 
 |  |  |         Sync_TeamMemberInfo(curTeam)
 | 
 |  |  |         SyncMapServerTeamInfo(curTeam, "ReadMapOK", {"playerID":curPlayer.GetPlayerID()})
 | 
 |  |  |          | 
 |  |  |     #curTeamMember = curTeam.GetMemberByID(curPlayer.GetPlayerID())
 | 
 |  |  |     ##通知MapServerd队伍变更
 | 
 |  |  |     #curPlayer.MapServer_Sync_Team(curTeamMember.GetTeamLV())
 | 
 |  |  |     return True
 | 
 |  |  | #---------------------------------------------------------------------
 | 
 |  |  | ##组队玩家切换地图
 | 
 |  |  | 
 |  |  |     curTeam = curPlayer.GetTeam()
 | 
 |  |  |     
 | 
 |  |  |     if curTeam != None:
 | 
 |  |  |         SyncMapServerTeamInfo(curTeam)
 | 
 |  |  |         SyncMapServerTeamInfo(curTeam, "ChangeMap", {"playerID":playerID, "mapID":mapID})
 | 
 |  |  |         #通知客户端更新
 | 
 |  |  |         curPlayer.Sync_TeamMemberChangeMap() # 09 13 队伍成员切换地图#tagTeamMemberChangeMap
 | 
 |  |  |         
 | 
 |  |  | 
 |  |  |         # 玩家进入组队副本,则停止匹配
 | 
 |  |  |         if gameMap.GetMapFBType() == ChConfig.fbtTeam:
 | 
 |  |  |             DelPlayerIDFromMatchingList(curPlayer)
 | 
 |  |  |              | 
 |  |  |         SyncMapServerPlayerNoTeam(curPlayer) # 没有队伍的时候切图也通知地图
 | 
 |  |  |          | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | def PlayerTeamMemberRefresh(curPlayer, refreshType, value, tick):
 | 
 |  |  | 
 |  |  |     elif refreshType == IPY_GameServer.CDBPlayerRefresh_OfficialRank:
 | 
 |  |  |         teamMember.SetPlayerRealmLV(value)
 | 
 |  |  |     elif refreshType in [IPY_GameServer.CDBPlayerRefresh_VIPLv, IPY_GameServer.CDBPlayerRefresh_ExAttr9]:
 | 
 |  |  |         SyncMapServerTeamInfo(curTeam)
 | 
 |  |  |         SyncMapServerTeamInfo(curTeam, "Refresh", {"refreshType":refreshType, "value":value})
 | 
 |  |  |     else:
 | 
 |  |  |         return
 | 
 |  |  |     
 | 
 |  |  | 
 |  |  |         tagMapTeam.NameLen = len(tagMapTeam.PlayerName)
 | 
 |  |  |         tagMapTeam.LV = leader.GetLV()
 | 
 |  |  |         tagMapTeam.Job = leader.GetJob()
 | 
 |  |  |         tagMapTeam.JobLevel = PlayerControl.GetJobRank(leader)
 | 
 |  |  |         tagMapTeam.RealmLV = leader.GetOfficialRank()
 | 
 |  |  |         tagMapTeam.MemberCount = team.GetTeamPlayerCount()
 | 
 |  |  |         tagMapTeam.ReqMinLV = team.GetReqMinLV()
 | 
 |  |  | 
 |  |  |         return
 | 
 |  |  |     
 | 
 |  |  |     playerLV = curPlayer.GetLV()
 | 
 |  |  |     matchMapIDList = [ChConfig.Def_FBMapID_DuJie, ChConfig.Def_FBMapID_MunekadoTrial, ChConfig.Def_FBMapID_QueenRelics, ChConfig.Def_FBMapID_ChaosDemon]
 | 
 |  |  |     matchMapIDList = [ChConfig.Def_FBMapID_DuJie, ChConfig.Def_FBMapID_MunekadoTrial, ChConfig.Def_FBMapID_QueenRelics, ChConfig.Def_FBMapID_ChaosDemon,
 | 
 |  |  |                       ChConfig.Def_FBMapID_KillDevil]
 | 
 |  |  |     
 | 
 |  |  |     teamMgr = GameWorld.GetTeamManager()
 | 
 |  |  |     for matchMapID in matchMapIDList:
 | 
 |  |  | 
 |  |  |                                                       ["TeamEnterCDMe", "TeamEnterCDAll"], "SingleEnterCD"],
 | 
 |  |  |                      ShareDefine.EntFBAskRet_LVLimit:[["TeamMatchingLVMe", "TeamMatchingLVAll"], 
 | 
 |  |  |                                                       ["TeamEnterLVMe", "TeamEnterLVAll"], "FbLV"],
 | 
 |  |  |                      ShareDefine.EntFBAskRet_JobRankLimit:[["TeamMatchingJobMe", "TeamMatchingJobAll"],  | 
 |  |  |                                                            ["TeamEnterJobMe", "TeamEnterJobAll"], "SingleEnterJob"],
 | 
 |  |  |                      ShareDefine.EntFBAskRet_NoTicket:[["TeamMatchingTicketMe", "TeamMatchingTicketAll"], 
 | 
 |  |  |                                                        ["TeamEnterTicketMe", "TeamEnterTicketAll"], "GeRen_chenxin_157069"],
 | 
 |  |  |                      ShareDefine.EntFBAskRet_Dead:[["TeamMatchingDeadMe", "TeamMatchingDeadAll"], 
 | 
 |  |  | 
 |  |  |                                                    ["TeamEnterDefaultMe", "TeamEnterDefaultAll"], "SingleEnterDefaul"],
 | 
 |  |  |                      ShareDefine.EntFBAskRet_Sit:[["TeamMatchingSITMe", "TeamMatchingSITAll"], 
 | 
 |  |  |                                                   ["TeamEnterSITMe", "TeamEnterSITAll"], "Carry_lhs_697674"],
 | 
 |  |  |                      ShareDefine.EntFBAskRet_CrossPKMatching:[["CrossMatching9", "CrossMatching10"],  | 
 |  |  |                                                   ["CrossMatching11", "CrossMatching12"], "CrossMatching8"],
 | 
 |  |  |                      ShareDefine.EntFBAskRet_InCrossMap:[["CrossMap6", "CrossMap7"],  | 
 |  |  |                                                   ["CrossMap8", "CrossMap9"], "CrossMap5"],
 | 
 |  |  |                      ShareDefine.EntFBAskRet_Other:[["TeamMatchingDefaultMe", "TeamMatchingDefaultAll"], 
 | 
 |  |  |                                                    ["TeamEnterDefaultMe", "TeamEnterDefaultAll"], "SingleEnterDefaul"],
 | 
 |  |  |                      }
 | 
 |  |  | 
 |  |  |             
 | 
 |  |  |             if memPlayerID in causePlayerDict:
 | 
 |  |  |                 PlayerControl.NotifyCode(memPlayer, notifyList[0], [askMapID])
 | 
 |  |  |                 if notifyRet in [ShareDefine.EntFBAskRet_NoEnterCnt, ShareDefine.EntFBAskRet_EnterCD, ShareDefine.EntFBAskRet_NoTicket]:
 | 
 |  |  |                     failPack = ChPyNetSendPack.tagGCEnterTeamFBFailReason()
 | 
 |  |  |                     failPack.MapID = askMapID
 | 
 |  |  |                     failPack.AskType = retAskType
 | 
 |  |  |                     failPack.Reason = notifyRet
 | 
 |  |  |                     NetPackCommon.SendFakePack(memPlayer, failPack)
 | 
 |  |  |             else:
 | 
 |  |  |                 PlayerControl.NotifyCode(memPlayer, notifyList[1], [askMapID, causePlayerName])
 | 
 |  |  |     return
 | 
 |  |  | 
 |  |  |     askMapID, askMapEx, memStateDict = PyGameData.g_prepareTeamDict[teamID][:3]
 | 
 |  |  |     enterInfo = GetTeamFBEnterInfo(leader, curTeam, askMapID, askMapEx)
 | 
 |  |  |     
 | 
 |  |  |     leaderID = leader.GetPlayerID()
 | 
 |  |  |     friendList = []
 | 
 |  |  |     memFamilyIDDict = {}
 | 
 |  |  |     memNameDict = {}
 | 
 |  |  |     #队长与队员的关系
 | 
 |  |  |     for index in xrange(curTeam.GetMemberCount()):
 | 
 |  |  |         memPlayer = curTeam.GetMemberPlayer(index)
 | 
 |  |  |         if not memPlayer or not memPlayer.GetPlayerID():
 | 
 |  |  |             continue
 | 
 |  |  |         memPlayerID = memPlayer.GetPlayerID()
 | 
 |  |  |         if memPlayerID not in memStateDict:
 | 
 |  |  |             continue
 | 
 |  |  |         memFamilyIDDict[memPlayerID] = memPlayer.GetFamilyID() # 存储各队员的家族ID
 | 
 |  |  |         memNameDict[memPlayerID] = memPlayer.GetName()
 | 
 |  |  |         if leaderID != memPlayerID and PlayerFriend.IsFriend(leaderID, memPlayerID):
 | 
 |  |  |             friendList.append([leaderID, memPlayerID])
 | 
 |  |  |              | 
 |  |  |     #踢出所有在此类副本,但不同线路的玩家
 | 
 |  |  |     for index in xrange(curTeam.GetMemberCount()):
 | 
 |  |  |         memPlayer = curTeam.GetMemberPlayer(index)
 | 
 |  |  | 
 |  |  |             resultName = str([askMapID, askMapEx] + enterInfo)
 | 
 |  |  |             memPlayer.MapServer_QueryPlayerResult(0, 0, "EnterFBTeamAsk", resultName, len(resultName))
 | 
 |  |  |             GameWorld.Log("队长成功进入组队副本, 队员开始进入副本: teamID=%s,memPlayerID=%s" % (teamID, memPlayerID), leader.GetPlayerID())
 | 
 |  |  |              | 
 |  |  |             for preMemPlayerID in memStateDict.keys():
 | 
 |  |  |                 if memPlayerID == preMemPlayerID:
 | 
 |  |  |                     continue
 | 
 |  |  |                 if PlayerFriend.IsFriend(memPlayerID, preMemPlayerID) and [memPlayerID, preMemPlayerID] not in friendList:
 | 
 |  |  |                     friendList.append([memPlayerID, preMemPlayerID])
 | 
 |  |  |                      | 
 |  |  |     PyGameData.g_prepareTeamDict.pop(teamID)
 | 
 |  |  |      | 
 |  |  |     # 同步进入组队副本的队员关系到目标地图
 | 
 |  |  |     relationInfo = str(["InitRelation", teamID, friendList, memFamilyIDDict, memNameDict])
 | 
 |  |  |     leader.MapServer_QueryPlayerResult(0, 0, "EnterFBTeamRelation", relationInfo, len(relationInfo))
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | def OnTeamMemFriendChange(curPlayer, tagPlayerID, isFriend):
 | 
 |  |  |     ## 队员好友关系变更,离线也同步
 | 
 |  |  |     teamID = curPlayer.GetTeamID()
 | 
 |  |  |     if not teamID:
 | 
 |  |  |         GameWorld.DebugLog("好友变更,无队伍不管!")
 | 
 |  |  |         return
 | 
 |  |  |     curMapData = GameWorld.GetMap(curPlayer.GetMapID())
 | 
 |  |  |     if not curMapData or curMapData.GetMapFBType() != ChConfig.fbtTeam:
 | 
 |  |  |         GameWorld.DebugLog("好友变更,不在组队副本不管!")
 | 
 |  |  |         return
 | 
 |  |  |      | 
 |  |  |     isSameTeam = False
 | 
 |  |  |     playerID = curPlayer.GetPlayerID()
 | 
 |  |  |     curTeam = curPlayer.GetTeam()
 | 
 |  |  |     for index in xrange(curTeam.GetMemberCount()):
 | 
 |  |  |         memberInfo = curTeam.GetMemberInfo(index)
 | 
 |  |  |         if not memberInfo:
 | 
 |  |  |             continue
 | 
 |  |  |         memPlayerID = memberInfo.GetPlayerID()
 | 
 |  |  |         if tagPlayerID == memPlayerID:
 | 
 |  |  |             isSameTeam = True
 | 
 |  |  |             break
 | 
 |  |  |          | 
 |  |  |     if not isSameTeam:
 | 
 |  |  |         GameWorld.DebugLog("好友关系变更,不是同队伍不管!")
 | 
 |  |  |         return
 | 
 |  |  |      | 
 |  |  |     relationInfo = str(["FriendChange", teamID, playerID, tagPlayerID, isFriend])
 | 
 |  |  |     curPlayer.MapServer_QueryPlayerResult(0, 0, "EnterFBTeamRelation", relationInfo, len(relationInfo))
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | def OnTeamMemFamilyRefresh(curPlayer, familyID):
 | 
 |  |  |     ## 队员仙盟变更,仅在线同步,上线同步
 | 
 |  |  |     if not curPlayer:
 | 
 |  |  |         return
 | 
 |  |  |     teamID = curPlayer.GetTeamID()
 | 
 |  |  |     if not teamID:
 | 
 |  |  |         GameWorld.DebugLog("家族变更,无队伍不管!")
 | 
 |  |  |         return
 | 
 |  |  |     curMapData = GameWorld.GetMap(curPlayer.GetMapID())
 | 
 |  |  |     if not curMapData or curMapData.GetMapFBType() != ChConfig.fbtTeam:
 | 
 |  |  |         GameWorld.DebugLog("家族变更,不在组队副本不管!")
 | 
 |  |  |         return
 | 
 |  |  |     playerID = curPlayer.GetPlayerID()
 | 
 |  |  |     familyID = curPlayer.GetFamilyID()
 | 
 |  |  |     relationInfo = str(["FamilyChange", teamID, playerID, familyID])
 | 
 |  |  |     curPlayer.MapServer_QueryPlayerResult(0, 0, "EnterFBTeamRelation", relationInfo, len(relationInfo))
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | def __CheckTeamFBPlayerExist(curTeam):
 | 
 |  |  | 
 |  |  |         if curInviteCnt >= inviteCnt:
 | 
 |  |  |             break
 | 
 |  |  |         
 | 
 |  |  |     return | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | def DR_Team(eventName, teamID, dataDict):
 | 
 |  |  |     #drDict = {"EventName":eventName, "TeamID":teamID}
 | 
 |  |  |     #drDict.update(dataDict)
 | 
 |  |  |     #DataRecordPack.SendEventPack("Team_GameServer", drDict)
 | 
 |  |  |     return
 | 
 |  |  | 
 |