xdh
2019-06-10 c3bb4072a13fc6e9541c971dec3f2865184136cd
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossRealmPK.py
@@ -114,7 +114,6 @@
    fbTimeList = IpyGameDataPY.GetFuncEvalCfg("CrossRealmPKFB", 1)
    
    if fbStep == FB_State_Open:
        curPlayer.SetFaction(1)
        gameFB.SetGameFBDict(GameFBDict_FBPlayerID % 1, playerID)
        gameFB.SetPlayerGameFBDict(playerID, FBPDict_ResetPosX, curPlayer.GetPosX())
        gameFB.SetPlayerGameFBDict(playerID, FBPDict_ResetPosY, curPlayer.GetPosY())
@@ -130,7 +129,6 @@
        playerIDA = gameFB.GetGameFBDictByKey(GameFBDict_FBPlayerID % 1)
        playerIDB = gameFB.GetGameFBDictByKey(GameFBDict_FBPlayerID % 2)
        if not playerIDB and playerIDA != playerID:
            curPlayer.SetFaction(2)
            gameFB.SetGameFBDict(GameFBDict_FBPlayerID % 2, playerID)
            gameFB.SetPlayerGameFBDict(playerID, FBPDict_ResetPosX, curPlayer.GetPosX())
            gameFB.SetPlayerGameFBDict(playerID, FBPDict_ResetPosY, curPlayer.GetPosY())
@@ -155,6 +153,8 @@
        curPlayer.Sync_TimeTick(ChConfig.tttTowerTake, 0, max(notify_tick, 0), True)
        
    FBCommon.Notify_FBHelp(curPlayer, __GetFBHelpInfo())
    PlayerControl.DelLimitSuperBuff(curPlayer, tick)
    PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
    return
def __GetFBHelpInfo():
@@ -198,7 +198,7 @@
    gameFB = GameWorld.GetGameFB()
    fbStep = gameFB.GetFBStep()
    
    if fbStep <= FB_State_Waiting and fbStep >= FB_State_Leave:
    if fbStep <= FB_State_Waiting or fbStep >= FB_State_Leave:
        return
    
    leavePlayerID = curPlayer.GetPlayerID()
@@ -296,14 +296,21 @@
        playerInfoList = []
        for playerID in [playerIDA, playerIDB]:
            player = copyMapPlayerManager.FindPlayerByID(playerID)
            # 还是离线时间的,走掉线逻辑,越晚掉线的赢;需要加这个逻辑主要是因为当玩家没有触发完整登录流程导致玩家在线但是没有触发DoEnter
            playerLeaveTick = gameFB.GetGameFBDictByKey(GameFBDict_PlayerLeaveTick % playerID)
            if playerLeaveTick:
                pvpDamage, sortTick, curHP, curMaxHP = 0, 0, 0, 0
                playerInfoList.append([pvpDamage, sortTick, curHP, curMaxHP, playerLeaveTick, playerID, player])
                GameWorld.Log("PK超时: playerLeaveTick=%s" % (playerLeaveTick), playerID)
                continue
            pvpDamage = gameFB.GetPlayerGameFBDictByKey(playerID, FBPDict_PVPDamage)
            pvpDamTick = gameFB.GetPlayerGameFBDictByKey(playerID, FBPDict_PVPDamUpdTick)
            sortTick = tick - pvpDamTick
            curHP = 0 if not player else player.GetHP()
            curMaxHP = 0 if not player else player.GetMaxHP()
            playerInfoList.append([pvpDamage, sortTick, curHP, curMaxHP, playerID, player])
            GameWorld.Log("PK超时: pvpDamge=%s,pvpDamTick=%s,tick=%s,sortTick=%s,HP=%s/%s"
                          % (pvpDamage, pvpDamTick, tick, sortTick, curHP, curMaxHP), playerID)
            playerInfoList.append([pvpDamage, sortTick, curHP, curMaxHP, playerLeaveTick, playerID, player])
            GameWorld.Log("PK超时: pvpDamge=%s,pvpDamTick=%s,tick=%s,sortTick=%s,HP=%s/%s,playerLeaveTick=%s"
                          % (pvpDamage, pvpDamTick, tick, sortTick, curHP, curMaxHP, playerLeaveTick), playerID)
            
        playerInfoList.sort(reverse=True)
        GameWorld.Log("PK超时, 进入结算!playerInfoList=%s" % str(playerInfoList))
@@ -317,6 +324,10 @@
    for i in xrange(copyMapPlayerManager.GetPlayerCount()):
        player = copyMapPlayerManager.GetPlayerByIndex(i)
        if player == None or player.IsEmpty():
            continue
        playerID = player.GetPlayerID()
        if playerID not in [playerIDA, playerIDB]:
            GameWorld.ErrLog("副本中玩家不在进入的玩家ID里,不处理! roomID=%s,playerID=%s" % (roomID, playerID))
            continue
        winner = player
        winnerID = player.GetPlayerID()
@@ -383,6 +394,9 @@
    prepareTime = fbTimeList[Def_Time_MapPrepare] * 1000
    helpDict["prepareTime"] = prepareTime
    
    roundNum = gameFB.GetGameFBDictByKey(FB_RoundNum)
    winnerID = gameFB.GetGameFBDictByKey(FB_RoundWinPlayerID % roundNum)
    nextRoundNum = gameFB.GetGameFBDictByKey(FB_RoundNum) + 1
    gameFB.SetGameFBDict(FB_RoundNum, nextRoundNum)
    
@@ -397,8 +411,11 @@
        
        if player.GetPlayerAction() == IPY_GameWorld.paDie or player.GetHP() <= 0:
            GameWorld.DebugLog("复活玩家...", player.GetPlayerID())
            ChPlayer.PlayerRebornByType(player, ChConfig.rebornType_System, tick)
            ChPlayer.PlayerRebornByType(player, ChConfig.rebornType_System, tick, isAddSuperBuff=False)
            __ResetPlayerState(gameFB, player, playerID)
        elif winnerID and playerID != winnerID:
            GameWorld.DebugLog("平局,输的玩家回满血!", playerID)
            __ResetPlayerState(gameFB, player, playerID)
        else:
            __ResetPlayerState(gameFB, player, playerID, False)
                
@@ -474,6 +491,22 @@
    GameWorld.Log("回合结束: roomID=%s,roundNum=%s,winnerID=%s,loserID=%s,updWinCnt=%s" % (roomID, roundNum, winnerID, loserID, updWinCnt))
    isOver = (updWinCnt >= IpyGameDataPY.GetFuncCfg("CrossRealmPKFB", 3))
    if not isOver:
        if winner:
            clearDeBuff = False
            # 胜利者马上清除负面buff,防止死亡导致回合表现异常,如中毒
            for buffType in [IPY_GameWorld.bfDeBuff, IPY_GameWorld.bfProcessDeBuff, IPY_GameWorld.bfActionBuff]:
                buffTuple = SkillCommon.GetBuffManagerByBuffType(winner, buffType)
                if buffTuple:
                    buffState = buffTuple[0]
                    buffCount = buffState.GetBuffCount()
                    if buffCount:
                        clearDeBuff = True
                        buffState.Clear()
                        GameWorld.DebugLog("胜者马上清除 buffType=%s,buffCount=%s" % (buffType, buffCount), winner.GetPlayerID())
            if clearDeBuff:
                PlayerControl.PlayerControl(winner).RefreshAllState()
        FBCommon.SetFBStep(FB_State_Reborn, tick)
        return