From edc3910a9d090e5df4deb2dbc37709a740375938 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期四, 12 六月 2025 12:18:42 +0800 Subject: [PATCH] 121 【武将】武将系统-服务端(图鉴;) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py index a9dcf21..a08a79c 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py @@ -2103,6 +2103,32 @@ numValue += pow(10, dataIndex)*(dataValue - lastTagLV) return numValue +def GetValue(dataValue, fromRight, bits): + '''获取某个数值中,从右往左数第x位开始,截图n位得到的数据 + @param dataValue: 原始数值 + @param fromRight: 从右往左数第x位开始,从1开始 + @param bits: 截取n位 + @return: 数值value + ''' + lPow = pow(10, fromRight) + rPow = pow(10, fromRight - bits) + curValue = dataValue % lPow / rPow + return curValue + +def SetValue(dataValue, fromRight, bits, updValue): + '''修改某个数值,从右往左数第x位开始,截图n位得到的数据,替换为具体数值 + @param dataValue: 原始数值 + @param fromRight: 从右往左数第x位开始,从1开始 + @param bits: 截取n位 + @param updValue: 替换值 + @return: 修改后的value值 + ''' + lPow = pow(10, fromRight) + rPow = pow(10, fromRight - bits) + leftValue = dataValue / lPow * lPow + rightValue = dataValue % rPow + return leftValue + updValue * rPow + rightValue + def GetBitValue(dataValue, index): """ 得到某个字节值中某一位(Bit)的值 @param dataValue: 待取值的字节值 -- Gitblit v1.8.0