From 906b770f36e320a504d33c970f1f8fb85674e7d5 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 21 一月 2025 17:09:06 +0800
Subject: [PATCH] 10382 【后台】称号管理支持升星(支持升星、设置星级,支持离线设置;发放代币、后台充值、头像管理增加离线操作支持;)

---
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerTeam.py |  193 ++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 153 insertions(+), 40 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerTeam.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerTeam.py
index 3f00186..6a4647b 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerTeam.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerTeam.py
@@ -15,6 +15,7 @@
 #"""Version = 2015-07-17 13:50"""
 #---------------------------------------------------------------------
 
+import PlayerAssist
 #import PlayerRequest
 import GameWorldBoss
 import IpyGameDataPY
@@ -306,7 +307,8 @@
         GameWorld.ErrLog("设置当前创建队伍玩家为队长, 找不到玩家!teamID=%s" % teamID, curPlayerID)
         DR_Team("CreateError", teamID, {"Leader":curPlayerID, "tagMapID":tagMapID, "tagMapEx":tagMapEx, "reqMinLV":reqMinLV, "reqMaxLV":reqMaxLV})
         return
-    
+    curNewTeamMenber.SetFace(curPlayer.GetFace())
+    curNewTeamMenber.SetFacePic(curPlayer.GetFacePic())
     __SetTeamLV(curNewTeamMenber, IPY_GameServer.tmlLeader, False)
     if isSync:
         Sync_TeamMemberInfo(curNewTeam)
@@ -342,9 +344,9 @@
     
     #邀请组队的时候,双方都有队伍不处理
     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:
@@ -358,6 +360,24 @@
     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
@@ -389,20 +409,36 @@
         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()
+        requestPack.Face = curPlayer.GetFace()
+        requestPack.FacePic = curPlayer.GetFacePic()
+        NetPackCommon.SendFakePack(tagPlayer, requestPack)
+        
+        #TeamAskSuccess: 已成功发送入队申请
+        PlayerControl.NotifyCode(curPlayer, "TeamAskSuccess")
     else:
         # 请求加入队伍(#被请求的玩家有队,请求加入其队伍)
         RequestJoinTeamReq(curPlayer, tagPlayerTeam, tick)
@@ -463,7 +499,6 @@
     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
@@ -524,8 +559,9 @@
     requestPack.NameLen = len(requestPack.Name)
     requestPack.LV = curPlayer.GetLV()
     requestPack.Job = curPlayer.GetJob()
-    requestPack.JobLevel = PlayerControl.GetJobRank(curPlayer)
     requestPack.RealmLV = curPlayer.GetOfficialRank()
+    requestPack.Face = curPlayer.GetFace()
+    requestPack.FacePic = curPlayer.GetFacePic()
     NetPackCommon.SendFakePack(tagPlayer, requestPack)
     
     #TeamAskSuccess: 已成功发送入队申请
@@ -556,6 +592,8 @@
         member.Job = memberInfo.GetPlayerJob()
         member.JobLevel = memberInfo.GetPlayerJobLevel()
         member.RealmLV = memberInfo.GetPlayerRealmLV()
+        member.Face = memberInfo.GetFace()
+        member.FacePic = memberInfo.GetFacePic()
 
         memberPlayer = curTeam.GetMemberPlayer(i)
         if memberPlayer and memberPlayer.GetPlayerID():
@@ -592,6 +630,11 @@
         PlayerControl.NotifyCode(curPlayer, "TeamEnterForbid")
         return False
     
+    if PlayerControl.GetAssistTagPlayerID(curPlayer):
+        #协助中无法执行此操作
+        PlayerControl.NotifyCode(curPlayer, "InAssistForbid")
+        return False
+    
     if tagPlayer:
         tagPlayerID = tagPlayer.GetPlayerID()
         #检查ID
@@ -614,6 +657,11 @@
             return False
         if IsInEnterFBTeamPrepare(tagTeamID):
             PlayerControl.NotifyCode(curPlayer, "TeamEnterForbid")
+            return False
+        
+        if PlayerControl.GetAssistTagPlayerID(tagPlayer):
+            #对方协助中,无法执行此操作
+            PlayerControl.NotifyCode(curPlayer, "TagInAssistForbid")
             return False
         
     return True
@@ -658,7 +706,7 @@
         return
     
     #双方的队伍
-    #curPlayerTeam = curPlayer.GetTeam() 
+    curPlayerTeam = curPlayer.GetTeam() 
     tagPlayerTeam = tagPlayer.GetTeam()
     
     if tagPlayerTeam == None:
@@ -666,12 +714,10 @@
         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()
@@ -743,17 +789,20 @@
     #被邀请的玩家队伍
     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
     
     #===============================================================================================
     # #请求检查,是否有这个请求
@@ -821,6 +870,10 @@
     GameWorld.Log("%s(%d)加入队伍 %s(%d), teamID=%s!" % (joinPlayer.GetName(), joinPlayer.GetPlayerID(), 
                                                      teamPlayer.GetName(), teamPlayer.GetPlayerID(), teamID))
     tagTeam.AddMember(joinPlayer)
+    tagMember = tagTeam.GetMemberByID(joinPlayer.GetPlayerID())
+    if tagMember:
+        tagMember.SetFace(joinPlayer.GetFace())
+        tagMember.SetFacePic(joinPlayer.GetFacePic())
     #UpdSceneTeamVersion(teamPlayer.GetMapID(), tick)
     
     #tagTeam.Sync_TeamState()
@@ -1392,6 +1445,7 @@
     '''
     #GameWorld.DebugLog("玩家队伍变更通用处理,curTeamID=%s" % curPlayer.GetTeamID())
     GameWorldBoss.OnPlayerTeamChange(curPlayer)
+    PlayerAssist.OnPlayerTeamChange(curPlayer)
     return
 
 #---------------------------------------------------------------------
@@ -1515,13 +1569,16 @@
     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
@@ -1596,8 +1653,9 @@
         nearbyPlayer.NameLen = len(nearbyPlayer.Name)
         nearbyPlayer.LV = player.GetLV()
         nearbyPlayer.Job = player.GetJob()
-        nearbyPlayer.JobLevel = PlayerControl.GetJobRank(player)
         nearbyPlayer.RealmLV = player.GetOfficialRank()
+        nearbyPlayer.Face = player.GetFace()
+        nearbyPlayer.FacePic = player.GetFacePic()
         nearbyPlayerInfo.PlayerList.append(nearbyPlayer)
         
     playerCount = len(nearbyPlayerInfo.PlayerList)
@@ -1685,7 +1743,6 @@
         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()
@@ -1877,6 +1934,7 @@
     #如果队伍正在匹配中,则通知状态
     if IsTeamMatchingPlayer(curTeamID):
         Sync_TeamMatchState(curPlayer, True)
+    OnTeamMemFamilyRefresh(curPlayer, curPlayer.GetFamilyID())
     return True
 
 #---------------------------------------------------------------------
@@ -1992,6 +2050,10 @@
         teamMember.SetPlayerJobLevel(value)
     elif refreshType == IPY_GameServer.CDBPlayerRefresh_OfficialRank:
         teamMember.SetPlayerRealmLV(value)
+    elif refreshType == IPY_GameServer.CDBPlayerRefresh_Face:
+        teamMember.SetFace(value)
+    elif refreshType == IPY_GameServer.CDBPlayerRefresh_HairColor:
+        teamMember.SetFacePic(value)
     elif refreshType in [IPY_GameServer.CDBPlayerRefresh_VIPLv, IPY_GameServer.CDBPlayerRefresh_ExAttr9]:
         SyncMapServerTeamInfo(curTeam, "Refresh", {"refreshType":refreshType, "value":value})
     else:
@@ -2057,7 +2119,6 @@
         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()
@@ -2318,7 +2379,8 @@
         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:
@@ -2776,8 +2838,6 @@
                                                       ["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"], 
@@ -2794,6 +2854,10 @@
                                                    ["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"],
                      }
@@ -2953,8 +3017,57 @@
     PyGameData.g_prepareTeamDict.pop(teamID)
     
     # 同步进入组队副本的队员关系到目标地图
-    relationInfo = str([teamID, friendList, memFamilyIDDict, memNameDict])
+    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):
@@ -3132,8 +3245,8 @@
     return
 
 def DR_Team(eventName, teamID, dataDict):
-    drDict = {"EventName":eventName, "TeamID":teamID}
-    drDict.update(dataDict)
-    DataRecordPack.SendEventPack("Team_GameServer", drDict)
+    #drDict = {"EventName":eventName, "TeamID":teamID}
+    #drDict.update(dataDict)
+    #DataRecordPack.SendEventPack("Team_GameServer", drDict)
     return
 

--
Gitblit v1.8.0