hxp
2019-07-09 9ecc819548b23562caf3271c60334dc687d52e03
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
@@ -177,6 +177,7 @@
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_PKCount, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_WinCount, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CWinCount, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CLoseCount, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayPKCount, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayWinCount, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayBuyCount, 0)
@@ -240,6 +241,23 @@
    if requestType == 1:
        if not CheckHavePKCount(curPlayer):
            return
        danLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_DanLV)
        danIpyData = IpyGameDataPY.GetIpyGameData("CrossRealmPKDan", danLV)
        if not danIpyData:
            return
        cLoseCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_CLoseCount)
        matchRobotRate = danIpyData.GetMatchRobotRate() + danIpyData.GetMatchRobotRateEx() * cLoseCount
        isMatchRobot = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_IsMatchRobot)
        GameWorld.Log("isMatchRobot=%s,danLV=%s,cLoseCount=%s,匹配机器人概率=%s" % (isMatchRobot, danLV, cLoseCount, matchRobotRate), playerID)
        if isMatchRobot or (matchRobotRate and GameWorld.CanHappen(matchRobotRate, 100)):
            GameWorld.Log("    本次匹配到机器人!", playerID)
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_IsMatchRobot, 1)
            startMatchPack = ChPyNetSendPack.tagGCCrossRealmPKStartMatch()
            startMatchPack.IsRobot = 1
            NetPackCommon.SendFakePack(curPlayer, startMatchPack)
            return
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_IsMatchRobot, 0)
        
        dataMsg = {
                   "seasonID":GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKSeasonID), # 赛季ID
@@ -333,6 +351,7 @@
    
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TotalScore, pkScore)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DanLV, danLV)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_IsMatchRobot, 0)
    
    pkCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_PKCount) + 1
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_PKCount, pkCount)
@@ -341,10 +360,13 @@
        winCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_WinCount) + 1
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_WinCount, winCount)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CWinCount, cWinCount)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CLoseCount, 0)
        GameWorld.Log("    winner winCount=%s,cWinCount=%s" % (winCount, cWinCount), playerID)
    else:
        cLoseCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_CLoseCount) + 1
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CLoseCount, cLoseCount)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CWinCount, 0)
        GameWorld.Log("    loser cWinCount=0", playerID)
        GameWorld.Log("    loser cLoseCount=%s" % cLoseCount, playerID)
        
    # 同一天的话增加当日PK次数
    if isToday:
@@ -375,18 +397,13 @@
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    playerID = curPlayer.GetPlayerID()
    isWinner = clientData.IsWin
#    billboardCfg = IpyGameDataPY.GetFuncEvalCfg("CrossRealmPKCfg", 1, [])
#    if not billboardCfg or len(billboardCfg) != 2:
#        GameWorld.ErrLog("跨服竞技场排行榜配置错误!")
#        return
#    danLVLimit = billboardCfg[1]
#    playerDanLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_DanLV)
#    #策划设计该机器人目的为了前期体验,这里只验证是否超过上榜段位即可,即使作弊也不管,只要有次数即可
#    if playerDanLV >= danLVLimit:
#        GameWorld.ErrLog("该段位不允许与机器人匹配PK!playerDanLV=%s,danLVLimit=%s" % (playerDanLV, danLVLimit), playerID)
#        return
    
    if not CheckHavePKCount(curPlayer):
        return
    isMatchRobot = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_IsMatchRobot)
    if not isMatchRobot:
        GameWorld.DebugLog("当前不允许结算跨服匹配机器人!IsMatchRobot=%s" % isMatchRobot, playerID)
        return
    
    zoneID = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKZoneID)
@@ -423,6 +440,10 @@
    if winIpyData and winIpyData.GetLVUpScore() and pkScore >= winIpyData.GetLVUpScore():
        danLV += 1
        
    isToday = True # 机器人结算的默认当天
    if not __DoAddPKOverData(curPlayer, zoneID, seasonID, danLV, pkScore, cWinCount, isWinner, isToday):
        return
    # 只同步以下信息,其他信息前端自行补全
    overPack = ChPyNetSendPack.tagGCCrossRealmPKOverInfo()
    overPack.AddScore = addScore
@@ -431,8 +452,30 @@
    overPack.CWinCnt = cWinCount
    NetPackCommon.SendFakePack(curPlayer, overPack)
    
    isToday = True # 机器人结算的默认当天
    __DoAddPKOverData(curPlayer, zoneID, seasonID, danLV, pkScore, cWinCount, isWinner, isToday)
    # 通知跨服更新榜单积分数据
    billboardCfg = IpyGameDataPY.GetFuncEvalCfg("CrossRealmPKCfg", 1, [])
    if billboardCfg and len(billboardCfg) > 1 or danLV >= billboardCfg[1]:
        pass
#        dataMsg = {
#                   "seasonID":seasonID,
#                   "pkZoneID":zoneID,
#                   "accID":curPlayer.GetAccID(),
#                   "playerID":playerID,
#                   "playerName":CrossRealmPlayer.GetCrossPlayerName(curPlayer),
#                   "playerJob":curPlayer.GetJob(),
#                   "playerLV":curPlayer.GetLV(),
#                   "maxHP":curPlayer.GetMaxHP(),
#                   "maxProDef":PlayerControl.GetMaxProDef(curPlayer),
#                   "fightPower":curPlayer.GetFightPower(),
#                   "realmLV":curPlayer.GetOfficialRank(),
#                   "pkScore":pkScore,
#                   "danLV":danLV,
#                   "cWinCount":cWinCount,
#                   "ondayScore":curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_OnDayScore), # 过天时的积分
#                   }
#        GameWorld.SendMsgToCrossServer(ShareDefine.ClientServerMsg_PKMatch, dataMsg)
#        GameWorld.Log("    更新积分到跨服服务器 dataMsg=%s" % str(dataMsg), playerID)
    return