hxp
2022-02-21 0c27822ef5e6c67782ed143a4ff03ecfbdfda1fb
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
    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