ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerTeam.py
@@ -31,6 +31,7 @@
import copy
import time
import random
#---------------------------------------------------------------------
TeamFBAskType_Match = 0 # 组队副本进入询问类型 - 匹配
@@ -2915,3 +2916,44 @@
            SyncTeamEnterFBPrepareInfo(curTeam, askMapID, askMapEx, memStateDict, True)
    return
#// B9 0A 按条件邀请玩家加入队伍 #tagCGInvitePlayerJoinTeamByLV
#
#struct    tagCGInvitePlayerJoinTeamByLV
#{
#    tagHead        Head;
#    WORD        LVLimit;        // 目标玩家大于等于此等级
#    BYTE        InviteCnt;    // 邀请玩家个数
#};
def OnInvitePlayerJoinTeamByLV(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    lvlimit = clientData.LVLimit
    inviteCnt = clientData.InviteCnt
    curPlayerTeam = curPlayer.GetTeam()
    if not curPlayerTeam:
        return
    curInviteCnt = 0 #当前邀请数量
    playerManager = GameWorld.GetPlayerManager()
    playerCount = playerManager.GetActivePlayerCount()
    if playerCount < 2:
        return
    indexList = range(playerCount)
    random.shuffle(indexList)
    for i in indexList:
        tagPlayer = playerManager.GetActivePlayerAt(i)
        if tagPlayer == None or not tagPlayer.GetInitOK():
            continue
        if PlayerControl.GetIsTJG(tagPlayer):
            continue
        if tagPlayer.GetPlayerID() == curPlayer.GetPlayerID():
            continue
        if tagPlayer.GetLV() < lvlimit:
            continue
        if tagPlayer.GetTeam():
            continue
        if InvitePlayerJoinTeamReq(curPlayer, tagPlayer, curPlayerTeam, tick):
            curInviteCnt +=1
        if curInviteCnt >= inviteCnt:
            break
    return