From f51835257345c50c4d3e5e0ecda7455401fb76ad Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 17 十月 2024 14:51:31 +0800
Subject: [PATCH] 10263 【越南】【英文】后端支持NPC仿真实玩家战斗和快速战斗

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py
index 8d36902..8916fa9 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py
@@ -609,3 +609,52 @@
     # 由于float会有不精确的现象出现xxx.9999999或xxx.0000000000001的问题,所以这里计算出的结果向上取整
     return int(math.ceil(round(floatRMB * rate)))
 
+#64进制符号,前端用*号补空
+symbols64 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/'
+def Convert10To64(number):
+    """将十进制数转换为64进制"""
+    if number < 0:
+        number = abs(number)
+    result = ''
+    while number > 0:
+        result = symbols64[number % 64] + result
+        number //= 64
+    return result or '0'
+
+def Convert64To10(number64):
+    """将64进制数转换为十进制"""
+    value = 0
+    for digit in number64:
+        value = value * 64 + symbols64.index(digit)
+    return value
+
+def ParseSetting(playerSetting, index, cLen=1):
+    """解析玩家设置存储"""
+    s = playerSetting[index:index+cLen]
+    s = s.replace("*", "") # 前端*代表空
+    if not s:
+        return 0
+    return Convert64To10(s)
+
+def ParseSetting_AutoSkillList(playerSetting, defaultSkillList):
+    '''解析玩家设置  - 自动释放技能顺序列表
+    @param playerSetting: 玩家设置保存串
+    @param skillOrderList: 技能默认顺序列表
+    '''
+    playerSkillSetList = []
+    SkillMatchPage = ParseSetting(playerSetting, 30, 1)
+    fromIndex = 32 + SkillMatchPage * 15
+    indexNum = 0
+    for index in range(fromIndex, fromIndex + 15):
+        skillIndex = indexNum
+        v = ParseSetting(playerSetting, index, 1)
+        if v:
+            skillIndex = v - 1
+        
+        if skillIndex >= len(defaultSkillList):
+            break
+        skillID = defaultSkillList[skillIndex]
+        playerSkillSetList.append(skillID)
+        indexNum += 1
+    return playerSkillSetList
+

--
Gitblit v1.8.0