From 88d48aa6a91a4fd5996dfffaef9f82ce14f28a38 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期六, 08 二月 2025 18:42:05 +0800
Subject: [PATCH] 1111 【英文】【越南】【BT】【砍树】player空报错防范;
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py | 67 +++++++++++++++++++++++++++++++--
1 files changed, 63 insertions(+), 4 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py
index 2ef5864..8916fa9 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py
@@ -592,10 +592,69 @@
return ""
-def RMBToCoin(floatRMB):
- ''' 元转为分,统一函数,方便修改及搜索
+def CoinToYuan(orderCoin, rate=1):
+ '''coin转化为元
+ '''
+ yuan = orderCoin / float(rate)
+ if str(yuan).endswith(".0"):
+ return int(yuan)
+ return yuan
+
+def RMBToCoin(floatRMB, rate=100):
+ ''' 元转为coin,统一函数,方便修改及搜索
@param floatRMB: 单位元,float 类型,支持 RMB 或 美元
- @return: 转化为分数值
+ @param rate: 转化比例,越南版本配表及coin均使用越南盾原值,即比例为1:1,故默认值改1
+ @return: 转化为coin数值
'''
# 由于float会有不精确的现象出现xxx.9999999或xxx.0000000000001的问题,所以这里计算出的结果向上取整
- return int(math.ceil(round(floatRMB * 100)))
+ 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