From 0c27822ef5e6c67782ed143a4ff03ecfbdfda1fb Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 23 五月 2022 16:52:58 +0800
Subject: [PATCH] 9415 【BT】【后端】古神战场(副本内功能完整版本)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Map/GameMap.py |   65 +++++++++++++++++++++++++++++++-
 1 files changed, 63 insertions(+), 2 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Map/GameMap.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Map/GameMap.py
index 5168672..1ff81a7 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Map/GameMap.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Map/GameMap.py
@@ -21,13 +21,16 @@
 # @change: "2012-05-22 11:00" jiang 增加函数GetAreaTypeByMapPos()获取某一点所在的区域类型
 # @change: "2015-09-23 14:30" hxp 增加函数GetEmptyPlaceInAreaEx获取某点指定范围区域内的随机点
 #---------------------------------------------------------------------
-"""Version = 2015-09-23 14:30"""
+#"""Version = 2015-09-23 14:30"""
 #---------------------------------------------------------------------
 import GameWorld
 import random
 import ChConfig
 import AttackCommon
 import IPY_GameWorld
+import FormulaControl
+import IpyGameDataPY
+import GameObj
 #---------------------------------------------------------------------
 #########################################################
 #Python的pos定义
@@ -302,4 +305,62 @@
         effectID = curPosObj.GetEffectID(index)
         if effectID == findEffectID:
             return True
-    return False
\ No newline at end of file
+    return False
+
+def SpecialMapSetAttrValueByFormat(curPlayer):
+    import FBCommon
+    import PlayerControl
+    dataMapID = FBCommon.GetRecordMapID(GameWorld.GetMap().GetMapID())
+    ipyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("SpecMapPlayerAttrFormat", dataMapID)
+    if not ipyDataList:
+        return
+    
+    playerID = curPlayer.GetPlayerID()
+    GameWorld.DebugLog("特殊地图设置属性: dataMapID=%s" % dataMapID, playerID)
+    
+    for ipyData in ipyDataList:
+        attrName = ipyData.GetAttrName()
+        attrValueFormat = ipyData.GetAttrValueFormat()
+        
+        attrOwner = ""
+        # GameObj 的 Get、Set函数
+        getFuncName = "Get%s" % attrName
+        setFuncName = "Set%s" % attrName
+        if hasattr(GameObj, getFuncName) and hasattr(GameObj, setFuncName):
+            getFunc = getattr(GameObj, getFuncName)
+            setFunc = getattr(GameObj, setFuncName)
+            value = getFunc(curPlayer)
+            attrOwner = "GameObj"
+            
+        # PlayerControl 的 Get、Set函数
+        elif hasattr(PlayerControl, getFuncName) and hasattr(PlayerControl, setFuncName):
+            getFunc = getattr(PlayerControl, getFuncName)
+            setFunc = getattr(PlayerControl, setFuncName)
+            value = getFunc(curPlayer)
+            attrOwner = "PlayerControl"
+            
+        # curPlayer 的 Get、Set函数
+        elif hasattr(curPlayer, getFuncName) and hasattr(curPlayer, setFuncName):
+            getFunc = getattr(curPlayer, getFuncName)
+            setFunc = getattr(curPlayer, setFuncName)
+            value = getFunc()
+            attrOwner = "curPlayer"
+            
+        else:
+            GameWorld.ErrLog("特殊地图设置属性异常,不存在该属性! dataMapID=%s,attrName=%s" % (dataMapID, attrName), playerID)
+            continue
+        
+        if attrValueFormat.isdigit():
+            setValue = int(attrValueFormat)
+        else:
+            setValue = eval(FormulaControl.GetCompileFormula("SpecMapAttr_%s_%s" % (dataMapID, attrName), attrValueFormat))
+            
+        if attrOwner == "curPlayer":
+            setFunc(setValue)
+        else:
+            setFunc(curPlayer, setValue)
+            
+        GameWorld.DebugLog("    attrName=%s,value=%s,setValue=%s,%s" % (attrName, value, setValue, attrOwner), playerID)
+        
+    return
+    
\ No newline at end of file

--
Gitblit v1.8.0