From ce3255b65c0ab6fb2a93e416d39d547632287b51 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 16 四月 2024 17:08:38 +0800
Subject: [PATCH] 10019 【砍树】回合战斗(增加技能被动效果5015 5016 5017) 1. 增加技能被动效果ID 5015 - 被攻击触发,附加负面状态判断 2. 增加技能被动效果ID 5016 - 灵宠攻击后触发,附加目标负面状态判断 3. 增加技能被动效果ID 5017 - 攻击时提升攻击力,附加当前血量判
---
PySysDB/生成IpyGameDataPY/IpyGameDataPYCreater.py | 39 +++++++++++++++++++++++----------------
1 files changed, 23 insertions(+), 16 deletions(-)
diff --git "a/PySysDB/\347\224\237\346\210\220IpyGameDataPY/IpyGameDataPYCreater.py" "b/PySysDB/\347\224\237\346\210\220IpyGameDataPY/IpyGameDataPYCreater.py"
index 2648cf1..673f776 100644
--- "a/PySysDB/\347\224\237\346\210\220IpyGameDataPY/IpyGameDataPYCreater.py"
+++ "b/PySysDB/\347\224\237\346\210\220IpyGameDataPY/IpyGameDataPYCreater.py"
@@ -8,8 +8,12 @@
cfg = ConfigParser.ConfigParser()
cfg.read("config.ini")
-CodeProjectPath = cfg.get("config", "CodeProjectPath") # 代码项目路径
-
+CodeProjectPath = "" # 代码项目路径
+for i in range(1, 20):
+ folderPath = cfg.get("config", "CodeProjectPath%s" % i)
+ if os.path.isdir(folderPath):
+ CodeProjectPath = folderPath
+ break
IpyGameDataFile = "IpyGameDataPY.py" # 生成的py文件名
# 表结构定义字典模板
@@ -31,15 +35,19 @@
# 类初始化数值对象模板
ClassInitTemp = " self.%s = %s%s"
# 获取类对象函数模板
-ClassFuncTemp = " def Get%s(self): return self.%s%s%s"
+ClassFuncTemp = " def Get%s(self): return self.%s%s %s%s"
# 管理器初始化表数据缓存列表对象模板
-MgrTableCacheInit = " self.ipy%sCache = self.__LoadFileData(\"%s\", IPY_%s)%s"
-MgrTableLenInit = " self.ipy%sLen = len(self.ipy%sCache)%s"
-# 管理器获取表数据条数函数模板
-MgrGetCountFunc = " def Get%sCount(self): return self.ipy%sLen%s"
-# 管理器根据索引获取表数据函数模板
-MgrGetByIndexFunc = " def Get%sByIndex(self, index): return self.ipy%sCache[index]%s"
+MgrTableCacheInit = " self.__LoadFileData(\"%s\", onlyCheck)%s"
+# 管理器获取表数据条数、数据函数模板
+MgrGetCountFunc = '''
+ def Get%sCount(self):
+ self.CheckLoadData("%s")
+ return self.ipy%sLen\r
+ def Get%sByIndex(self, index):
+ self.CheckLoadData("%s")
+ return self.ipy%sCache[index]\r
+'''
Def_RN = "\r\n"
@@ -94,7 +102,7 @@
tableName = tableName.replace(" ", "") # 表名英文名
continue
- noteInfo = "" # 字段注释说明
+ noteInfo = " #" # 字段注释说明
if "//" in line:
signIndex = line.index("//")
noteInfo = " # %s" % line[signIndex+2:].rstrip()
@@ -155,19 +163,18 @@
classInitInfo += ClassInitTemp % (fieldName, "0.0", lineEnd)
else:
classInitInfo += ClassInitTemp % (fieldName, "0", lineEnd)
- classFuncInfo += ClassFuncTemp % (fieldName, fieldName, noteInfo, lineEnd)
+ callAttrValue = "attrTuple[%s]" % j # fieldName
+ classFuncInfo += ClassFuncTemp % (fieldName, callAttrValue, noteInfo, fieldType, lineEnd)
ipyTableDef += TableDefEnd % (Def_RN if i == len(Def_IpyTable) - 1 else (Def_RN * 2))
+ classInitInfo = ClassInitTemp % ("attrTuple", "None", "") # 优化内存,不使用内置 __dict__ 访问属性,改为使用tuple存value
classContent += ClassTemp % (tableNameCh, tableName, classInitInfo, classFuncInfo)
# 表列表、长度对象缓存
- mgrTableCacheObjInit += MgrTableCacheInit % (tableName, tableName, tableName, Def_RN)
- mgrTableCacheObjInit += MgrTableLenInit % (tableName, tableName, Def_RN)
+ mgrTableCacheObjInit += MgrTableCacheInit % (tableName, Def_RN)
# 表列表、长度获取函数
- mgrTableFunc += MgrGetCountFunc % (tableName, tableName, Def_RN)
- mgrTableFunc += MgrGetByIndexFunc % (tableName, tableName, Def_RN)
-
+ mgrTableFunc += MgrGetCountFunc % (tableName, tableName, tableName, tableName, tableName, tableName)
# 读取模板生成py代码
createPYContent = ""
--
Gitblit v1.8.0