hxp
2022-07-18 f9db0271bb2de8dc45dafc1ff67c9c9384f97d87
9670 【越南】【主干】【后端】移动速度放外挂监测
1个文件已修改
22 ■■■■■ 已修改文件
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -5925,6 +5925,8 @@
            
        curPlayer.ResetPos(posX, posY)
MoveDistCalcTick = "PYMoveDistCalcTick"
MoveDistSum = "PYMoveDistSum"
def PYPlayerNormalMove(curPlayer, clientPack, tick) :
    
    #玩家移动通用检查
@@ -5953,6 +5955,8 @@
        return False
    
    if curPlayer.GetPosX() == sendPack_SeverPosX and curPlayer.GetPosY() == sendPack_SeverPosY:
        curPlayer.SetDict(MoveDistCalcTick, tick)
        curPlayer.SetDict(MoveDistSum, 0)
        if moveType != 0 and sendPack_WorldTick - lastMoveTick < 222:
            # 减少同步率
            return True
@@ -5988,7 +5992,23 @@
                                                           sendPack_SeverPosX, sendPack_SeverPosY), curPlayer.GetID())
        return False
    
    calcTick = curPlayer.GetDictByKey(MoveDistCalcTick)
    distSum = min(curPlayer.GetDictByKey(MoveDistSum) + dist, 100000000)
    curPlayer.SetDict(MoveDistSum, distSum)
    if distSum > IpyGameDataPY.GetFuncCfg("PyMoveCheck", 1):
        speed = curPlayer.GetSpeed() # 移动一格所需毫秒
        passCalcTick = tick - calcTick
        needTick = distSum * speed
        checkNeedTick = needTick * IpyGameDataPY.GetFuncCfg("PyMoveCheck", 2) / 100.0
        if passCalcTick < checkNeedTick:
            GameWorld.DebugLog("    dist=%s,distSum=%s,speed=%s,needTick=%s, 所需移动时间异常 passCalcTick(%s) < (%s)"
                               % (dist, distSum, speed, needTick, passCalcTick, checkNeedTick), curPlayer.GetID())
            return False
        #GameWorld.DebugLog("    dist=%s,distSum=%s,speed=%s,needTick=%s, 验证移动时间正常  passCalcTick(%s) < (%s)"
        #                   % (dist, distSum, speed, needTick, passCalcTick, checkNeedTick), curPlayer.GetID())
        curPlayer.SetDict(MoveDistCalcTick, tick)
        curPlayer.SetDict(MoveDistSum, 0)
    #如果是小游戏中则停止小游戏
    if curPlayer.GetPlayerAction() == IPY_GameWorld.paGameEvent:
        PlayerGameEvent.StopGameEvent(curPlayer, tick)